/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainMenu.java
 *
 * Created on Nov 5, 2011, 4:26:24 PM
 */
package mpinventory;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import com.csvreader.CsvWriter;
import java.beans.PropertyVetoException;
import java.sql.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Calendar;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Timer;
import javax.swing.JFrame;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.DefaultListModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
/**
 *
 * @author msi
 */
public class MainMenu extends javax.swing.JPanel {

    private Connection conn;
    private Dimension size;
    public int width;
    public int height;
    public int screenWidth;
    public int screenHeight;
    public String name;
    private String origFirstname;
    private String origLastname;
    private String SUPosition;
    private String quantityUnit;
    private String TRStatus="All Releases";
    private String TPStatus="All Purchases";
    private String brand="All";
    public boolean hide=false;
    public boolean backToLogin=false;
    private DefaultTableModel modelAircon;
    private DefaultTableModel modelTP;
    private DefaultTableModel modelTR;
    private DefaultTableModel modelMIP;
    private List<User> users;
    private List<Item> items;
    private List<Customer> customers;
    private List<Supplier> suppliers;
    private List<TransactionPurchase> purchases;
    private List<Item> materials;
    private List<TransactionRelease> orders;
    private List<Installation> installations;
    private Installation installation;
    private TransactionPurchase purchase;
    private TransactionRelease order;
    private UserQuery userQuery;
    private ItemQuery itemQuery;
    private CustomerQuery customerQuery;
    private SupplierQuery supplierQuery;
    private TransactionPurchaseQuery purchaseQuery;
    private TransactionReleaseQuery releaseQuery;
    private InstallationQuery installationQuery;
    public AddUser addUser;
    public AddCustomer addCustomer;
    public AddInstallation addInstallation;
    public EditInstallation editInstallation;
    public AddItem addItem;
    public AddSupplier addSupplier;
    public AddTransactionRelease addTransactionRelease;
    public EditTransactionRelease editTransactionRelease;
    public AddTransactionPurchase addTransactionPurchase;
    public EditTransactionPurchase editTransactionPurchase;
    private JFrame addUserFrame;
    private JFrame addCustomerFrame;
    private JFrame addInstallationFrame;
    private JFrame editInstallationFrame;
    private JFrame addItemFrame;
    private JFrame addSupplierFrame;
    private JFrame addTransactionReleaseFrame;
    private JFrame editTransactionReleaseFrame;
    private JFrame addTransactionPurchaseFrame;
    private JFrame editTransactionPurchaseFrame;
    /** Creates new form MainMenu */
    public MainMenu() {
        initComponents();
    }
    public MainMenu(Connection conn, String name, String username, int screenWidth, int screenHeight) {
        this.conn=conn;
        this.name=name;
        this.screenWidth=screenWidth;
        this.screenHeight=screenHeight;
        initComponents();
        jLabel38.setVisible(false); //'confirm password' label
        jPasswordField2.setVisible(false);
        lblUser.setText(name);
        size=this.getPreferredSize();
        width=size.width+10;
        height=size.height;
        initializeItemList();
        itemQuery.interpretSearchBy(cbxInvSearchBy.getSelectedIndex());
        quantityUnit=cbxInvUnit.getSelectedItem().toString();
        if(username.equals("admin")){
            initializeUserList();
            userQuery.interpretSearchBy(cbxSUSearchBy.getSelectedIndex());
            SUPosition=cbxSUPosition.getSelectedItem().toString();
        }
        if(username.equals("admin") || username.equals("oprsmngr")){
            initializeCustomerList();
            initializeSupplierList();
            initializeReleaseList();
            initializePurchaseList();
            initializeMaterialList();
            customerQuery.interpretSearchBy(cbxCustSearchBy.getSelectedIndex());
            supplierQuery.interpretSearchBy(cbxSuppSearchBy.getSelectedIndex());
            TRStatus=cbxTRStatus.getSelectedItem().toString();
            TPStatus=cbxTPStatus.getSelectedItem().toString();
        }
        if(username.equals("admin") || username.equals("mecheng"))
            initializeAirConList();
        if(username.equals("acct")){
            initializeReleaseList();
            TRStatus=cbxTRStatus.getSelectedItem().toString();
        }
        cbxSUSearchBy.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                userQuery.interpretSearchBy(cbxSUSearchBy.getSelectedIndex());
            }
        });
        cbxInvSearchBy.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                itemQuery.interpretSearchBy(cbxInvSearchBy.getSelectedIndex());
            }
        });
        cbxCustSearchBy.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                customerQuery.interpretSearchBy(cbxCustSearchBy.getSelectedIndex());
            }
        });
        cbxSuppSearchBy.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                supplierQuery.interpretSearchBy(cbxSuppSearchBy.getSelectedIndex());
            }
        });
        cbxSUPosition.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                SUPosition=cbxSUPosition.getSelectedItem().toString();
            }
        });
        cbxInvUnit.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                quantityUnit=cbxInvUnit.getSelectedItem().toString();
            }
        });
        if(username.equals("oprsmngr") || username.equals("whcust") || username.equals("acct")){
            tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("System Users"));
            tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("Installation"));
            if(username.equals("whcust") || username.equals("acct")){
                tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("Customer"));
                tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("Supplier"));
                if(username.equals("whcust"))
                    tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("Transactions"));
                else{
                    tabTransactions.removeTabAt(tabTransactions.indexOfTab("Monitor Item Prices"));
                    btnInvAdd.setEnabled(false);
                    btnInvEdit.setEnabled(false);
                }
            }
        }
        else if(username.equals("mecheng")){
            tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("System Users"));
            tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("Customer"));
            tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("Supplier"));
            tabMainMenu.removeTabAt(tabMainMenu.indexOfTab("Transactions"));
            btnInvAdd.setEnabled(false);
            btnInvEdit.setEnabled(false);
        }
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                DateFormat dateFormat = new SimpleDateFormat("EEEE               MMMM dd, yyyy               hh:mm:ssa");
                Calendar cal = Calendar.getInstance();
                dateDayTime.setText(dateFormat.format(cal.getTime())+"");
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }
    @Override
    public int getWidth(){
        return width;
    }
    @Override
    public int getHeight(){
        return height;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        lblUser = new javax.swing.JLabel();
        btnLogout = new javax.swing.JButton();
        tabMainMenu = new javax.swing.JTabbedPane();
        panelSU = new javax.swing.JPanel();
        btnSUAdd = new javax.swing.JButton();
        btnSUEdit = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtSUUsername = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        txtSULastname = new javax.swing.JTextField();
        txtSUFirstname = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jPasswordField1 = new javax.swing.JPasswordField();
        cbxSUPosition = new javax.swing.JComboBox();
        jLabel38 = new javax.swing.JLabel();
        jPasswordField2 = new javax.swing.JPasswordField();
        jScrollPane1 = new javax.swing.JScrollPane();
        listUsers = new javax.swing.JList();
        jLabel2 = new javax.swing.JLabel();
        txtSU = new javax.swing.JTextField();
        cbxSUSearchBy = new javax.swing.JComboBox();
        btnSUSearch = new javax.swing.JButton();
        panelInventory = new javax.swing.JPanel();
        btnInvAdd = new javax.swing.JButton();
        btnInvEdit = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        listItems = new javax.swing.JList();
        jLabel10 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        txtInvPrice = new javax.swing.JTextField();
        txtInvID = new javax.swing.JTextField();
        txtInvQuantity = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        txtInvDescription = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        cbxInvUnit = new javax.swing.JComboBox();
        txtInv = new javax.swing.JTextField();
        cbxInvSearchBy = new javax.swing.JComboBox();
        btnInvSearch = new javax.swing.JButton();
        btnInvToCSV = new javax.swing.JButton();
        panelCustomer = new javax.swing.JPanel();
        btnCustAdd = new javax.swing.JButton();
        btnCustEdit = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jLabel23 = new javax.swing.JLabel();
        txtCConNum = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        txtCAddress = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        txtCName = new javax.swing.JTextField();
        txtCRemarks = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        txtCID = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        listCustomers = new javax.swing.JList();
        jLabel29 = new javax.swing.JLabel();
        txtCust = new javax.swing.JTextField();
        cbxCustSearchBy = new javax.swing.JComboBox();
        btnCustSearch = new javax.swing.JButton();
        btnCustToCSV = new javax.swing.JButton();
        panelSupplier = new javax.swing.JPanel();
        btnSuppAdd = new javax.swing.JButton();
        btnSuppEdit = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        txtSAddress = new javax.swing.JTextField();
        txtSConNum = new javax.swing.JTextField();
        txtSID = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        txtSName = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        listSuppliers = new javax.swing.JList();
        jLabel22 = new javax.swing.JLabel();
        txtSupp = new javax.swing.JTextField();
        cbxSuppSearchBy = new javax.swing.JComboBox();
        btnSuppSearch = new javax.swing.JButton();
        btnSuppToCSV = new javax.swing.JButton();
        panelTransactions = new javax.swing.JPanel();
        tabTransactions = new javax.swing.JTabbedPane();
        panelReleases = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jLabel69 = new javax.swing.JLabel();
        jLabel70 = new javax.swing.JLabel();
        txtTRID = new javax.swing.JTextField();
        jLabel71 = new javax.swing.JLabel();
        jLabel72 = new javax.swing.JLabel();
        txtTRDate = new javax.swing.JTextField();
        jLabel73 = new javax.swing.JLabel();
        txtTRName = new javax.swing.JTextField();
        jLabel74 = new javax.swing.JLabel();
        jScrollPane11 = new javax.swing.JScrollPane();
        tableTROrders = new javax.swing.JTable();
        jLabel75 = new javax.swing.JLabel();
        labelTRTotalPrice = new javax.swing.JLabel();
        cbxTRStatus = new javax.swing.JComboBox();
        jScrollPane12 = new javax.swing.JScrollPane();
        listReleases = new javax.swing.JList();
        jLabel77 = new javax.swing.JLabel();
        cbxSearchByTRStatus = new javax.swing.JComboBox();
        jLabel78 = new javax.swing.JLabel();
        btnTRAdd = new javax.swing.JButton();
        btnTREdit = new javax.swing.JButton();
        btnTRToCSV = new javax.swing.JButton();
        panelPurchases = new javax.swing.JPanel();
        btnTPAdd = new javax.swing.JButton();
        jLabel37 = new javax.swing.JLabel();
        cbxSearchByTPStatus = new javax.swing.JComboBox();
        jLabel44 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        listPurchases = new javax.swing.JList();
        jPanel8 = new javax.swing.JPanel();
        jLabel45 = new javax.swing.JLabel();
        txtTPDate = new javax.swing.JTextField();
        jLabel46 = new javax.swing.JLabel();
        jLabel47 = new javax.swing.JLabel();
        jLabel48 = new javax.swing.JLabel();
        jLabel49 = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        tableTPOrders = new javax.swing.JTable();
        txtTPName = new javax.swing.JTextField();
        txtTPID = new javax.swing.JTextField();
        jLabel50 = new javax.swing.JLabel();
        jLabel51 = new javax.swing.JLabel();
        labelTPTotalPrice = new javax.swing.JLabel();
        cbxTPStatus = new javax.swing.JComboBox();
        btnTPEdit = new javax.swing.JButton();
        btnTPToCSV = new javax.swing.JButton();
        panelMonitorItemPrices = new javax.swing.JPanel();
        jScrollPane13 = new javax.swing.JScrollPane();
        listMaterials = new javax.swing.JList();
        jLabel79 = new javax.swing.JLabel();
        jPanel12 = new javax.swing.JPanel();
        jScrollPane14 = new javax.swing.JScrollPane();
        tableMonitorItemPrices = new javax.swing.JTable();
        jLabel80 = new javax.swing.JLabel();
        txtItemDescription = new javax.swing.JTextField();
        panelInstallation = new javax.swing.JPanel();
        jLabel30 = new javax.swing.JLabel();
        btnInsEdit = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jLabel31 = new javax.swing.JLabel();
        txtInsID = new javax.swing.JTextField();
        txtInsBrand = new javax.swing.JTextField();
        txtInsModel = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        txtInsHorsePower = new javax.swing.JTextField();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        tableInsItemsSet = new javax.swing.JTable();
        jLabel35 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        txtInsDescription = new javax.swing.JTextField();
        btnInsAdd = new javax.swing.JButton();
        jScrollPane5 = new javax.swing.JScrollPane();
        listAirConUnits = new javax.swing.JList();
        jLabel36 = new javax.swing.JLabel();
        cbxSearchByBrand = new javax.swing.JComboBox();
        btnInsToCSV = new javax.swing.JButton();
        dateDayTime = new javax.swing.JLabel();

        jLabel1.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel1.setText("Welcome, ");

        lblUser.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        lblUser.setText("<user>");

        btnLogout.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        btnLogout.setText("Log out");
        btnLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutActionPerformed(evt);
            }
        });

        tabMainMenu.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        tabMainMenu.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));

        panelSU.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        panelSU.setName(""); // NOI18N
        panelSU.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnSUAdd.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnSUAdd.setText("Add");
        btnSUAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSUAddActionPerformed(evt);
            }
        });
        panelSU.add(btnSUAdd, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 510, 81, -1));

        btnSUEdit.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnSUEdit.setText("Edit");
        btnSUEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSUEditActionPerformed(evt);
            }
        });
        panelSU.add(btnSUEdit, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 510, 81, -1));

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel3.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel3.setText("System User Information");

        jLabel5.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel5.setText("Position:");

        jLabel6.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel6.setText("Username:");

        txtSUUsername.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSUUsername.setEnabled(false);

        jLabel7.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel7.setText("Password:");

        txtSULastname.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSULastname.setEnabled(false);

        txtSUFirstname.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSUFirstname.setEnabled(false);

        jLabel4.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel4.setText("Last Name:");

        jLabel8.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel8.setText("First Name:");

        jPasswordField1.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        jPasswordField1.setEnabled(false);

        cbxSUPosition.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxSUPosition.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Managing Director", "Operations Manager", "Warehouse Staff", "Mechanical Engineer", "Accountant" }));
        cbxSUPosition.setToolTipText("");
        cbxSUPosition.setEnabled(false);

        jLabel38.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel38.setText("<html>Confirm<br> Password:</html>");

        jPasswordField2.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(55, 55, 55))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addGap(18, 18, 18)
                                .addComponent(txtSUFirstname, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel6)
                                        .addComponent(jLabel7)
                                        .addComponent(jLabel5)
                                        .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(24, 24, 24)
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jPasswordField2, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
                                        .addComponent(jPasswordField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
                                        .addComponent(txtSUUsername, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
                                        .addComponent(cbxSUPosition, javax.swing.GroupLayout.Alignment.LEADING, 0, 243, Short.MAX_VALUE)))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel4)
                                    .addGap(21, 21, 21)
                                    .addComponent(txtSULastname, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(20, 20, 20))))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addComponent(jLabel3)
                .addGap(38, 38, 38)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jLabel8))
                    .addComponent(txtSUFirstname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jLabel4))
                    .addComponent(txtSULastname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(jLabel5))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(cbxSUPosition, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jLabel6))
                    .addComponent(txtSUUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(68, Short.MAX_VALUE))
        );

        panelSU.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 60, 390, 440));

        listUsers.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        listUsers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(listUsers);

        panelSU.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, 342, 390));

        jLabel2.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel2.setText("List of System Users:");
        panelSU.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1));

        txtSU.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSU.setText("Type a keyword");
        panelSU.add(txtSU, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 140, -1));

        cbxSUSearchBy.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxSUSearchBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Name", "Position", "Username" }));
        panelSU.add(cbxSUSearchBy, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 70, 80, -1));

        btnSUSearch.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnSUSearch.setText("Search");
        btnSUSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSUSearchActionPerformed(evt);
            }
        });
        panelSU.add(btnSUSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 70, 100, -1));

        tabMainMenu.addTab("System Users", null, panelSU, "");

        panelInventory.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        panelInventory.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnInvAdd.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnInvAdd.setText("Add");
        btnInvAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInvAddActionPerformed(evt);
            }
        });
        panelInventory.add(btnInvAdd, new org.netbeans.lib.awtextra.AbsoluteConstraints(291, 508, 81, -1));

        btnInvEdit.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnInvEdit.setText("Edit");
        btnInvEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInvEditActionPerformed(evt);
            }
        });
        panelInventory.add(btnInvEdit, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 508, 81, -1));

        listItems.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        listItems.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane2.setViewportView(listItems);

        panelInventory.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, 342, 390));

        jLabel10.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel10.setText("List of Materials:");
        panelInventory.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1));

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel9.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel9.setText("Material Information");

        jLabel11.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel11.setText("Unit Price:");

        jLabel12.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel12.setText("Item ID:");

        txtInvPrice.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInvPrice.setEnabled(false);

        txtInvID.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInvID.setEnabled(false);

        txtInvQuantity.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInvQuantity.setEnabled(false);

        jLabel13.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel13.setText("Description:");

        jLabel14.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel14.setText("Quantity:");

        txtInvDescription.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInvDescription.setEnabled(false);

        jLabel15.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel15.setText("Unit:");

        cbxInvUnit.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxInvUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "roll", "length", "pcs.", "ft.", "meters", "box", "sets", "pairs", "kl.", "cans", "gal.", "pint" }));
        cbxInvUnit.setEnabled(false);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15)
                            .addComponent(jLabel11)
                            .addComponent(jLabel14))
                        .addGap(31, 31, 31)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cbxInvUnit, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtInvPrice, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                            .addComponent(txtInvQuantity, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addGap(54, 54, 54)
                        .addComponent(txtInvID, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addGap(18, 18, 18)
                        .addComponent(txtInvDescription, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(92, Short.MAX_VALUE)
                .addComponent(jLabel9)
                .addGap(98, 98, 98))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(60, 60, 60)
                .addComponent(jLabel9)
                .addGap(57, 57, 57)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtInvID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtInvDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtInvQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(cbxInvUnit, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtInvPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addGap(6, 6, 6))
        );

        panelInventory.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 60, 410, 440));

        txtInv.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInv.setText("Type a keyword");
        panelInventory.add(txtInv, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 140, -1));

        cbxInvSearchBy.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxInvSearchBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Description", "Quantity", "Unit", "Price" }));
        panelInventory.add(cbxInvSearchBy, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 70, 80, -1));

        btnInvSearch.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnInvSearch.setText("Search");
        btnInvSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInvSearchActionPerformed(evt);
            }
        });
        panelInventory.add(btnInvSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 70, 100, -1));

        btnInvToCSV.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15)); // NOI18N
        btnInvToCSV.setText("CREATE CSV");
        btnInvToCSV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInvToCSVActionPerformed(evt);
            }
        });
        panelInventory.add(btnInvToCSV, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 510, -1, -1));

        tabMainMenu.addTab("Inventory", panelInventory);

        btnCustAdd.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnCustAdd.setText("Add");
        btnCustAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCustAddActionPerformed(evt);
            }
        });

        btnCustEdit.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnCustEdit.setText("Edit");
        btnCustEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCustEditActionPerformed(evt);
            }
        });

        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel23.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel23.setText("Customer Information");

        txtCConNum.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtCConNum.setEnabled(false);

        jLabel24.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel24.setText("Remarks:");

        jLabel25.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel25.setText("<html>Contact<br> Number/s:</html>");

        txtCAddress.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtCAddress.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        txtCAddress.setEnabled(false);

        jLabel26.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel26.setText("Address:");

        txtCName.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtCName.setEnabled(false);

        txtCRemarks.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtCRemarks.setEnabled(false);

        jLabel27.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel27.setText("Name:");

        txtCID.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtCID.setEnabled(false);

        jLabel28.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel28.setText("Customer ID:");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel28)
                                    .addComponent(jLabel27)
                                    .addComponent(jLabel26))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtCID, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtCAddress, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
                                    .addComponent(txtCName, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(43, 43, 43)
                                .addComponent(txtCConNum, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(jLabel24)
                                .addGap(48, 48, 48)
                                .addComponent(txtCRemarks, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE)))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addGap(74, 74, 74))))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addComponent(jLabel23)
                .addGap(39, 39, 39)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel28)
                    .addComponent(txtCID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(txtCName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(jLabel26))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(txtCAddress)))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtCConNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(txtCRemarks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(118, Short.MAX_VALUE))
        );

        listCustomers.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        listCustomers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane4.setViewportView(listCustomers);

        jLabel29.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel29.setText("List of Customers:");

        txtCust.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtCust.setText("Type a keyword");

        cbxCustSearchBy.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxCustSearchBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Name", "Address", "Contact Number/s", "Remarks" }));

        btnCustSearch.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnCustSearch.setText("Search");
        btnCustSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCustSearchActionPerformed(evt);
            }
        });

        btnCustToCSV.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15)); // NOI18N
        btnCustToCSV.setText("CREATE CSV");
        btnCustToCSV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCustToCSVActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelCustomerLayout = new javax.swing.GroupLayout(panelCustomer);
        panelCustomer.setLayout(panelCustomerLayout);
        panelCustomerLayout.setHorizontalGroup(
            panelCustomerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelCustomerLayout.createSequentialGroup()
                .addContainerGap(20, Short.MAX_VALUE)
                .addGroup(panelCustomerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel29)
                    .addGroup(panelCustomerLayout.createSequentialGroup()
                        .addGap(270, 270, 270)
                        .addComponent(btnCustAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29)
                        .addComponent(btnCustEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(149, 149, 149)
                        .addComponent(btnCustToCSV))
                    .addGroup(panelCustomerLayout.createSequentialGroup()
                        .addGroup(panelCustomerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelCustomerLayout.createSequentialGroup()
                                .addComponent(txtCust, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE)
                                .addGap(18, 18, 18)
                                .addComponent(cbxCustSearchBy, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnCustSearch))
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(19, 19, 19))
        );
        panelCustomerLayout.setVerticalGroup(
            panelCustomerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelCustomerLayout.createSequentialGroup()
                .addContainerGap(35, Short.MAX_VALUE)
                .addGroup(panelCustomerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelCustomerLayout.createSequentialGroup()
                        .addComponent(jLabel29)
                        .addGap(18, 18, 18)
                        .addGroup(panelCustomerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtCust, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCustSearch)
                            .addComponent(cbxCustSearchBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(15, 15, 15)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 388, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(panelCustomerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelCustomerLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(panelCustomerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnCustAdd)
                            .addComponent(btnCustEdit)))
                    .addGroup(panelCustomerLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCustToCSV)))
                .addContainerGap())
        );

        tabMainMenu.addTab("Customer", panelCustomer);

        btnSuppAdd.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnSuppAdd.setText("Add");
        btnSuppAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSuppAddActionPerformed(evt);
            }
        });

        btnSuppEdit.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnSuppEdit.setText("Edit");
        btnSuppEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSuppEditActionPerformed(evt);
            }
        });

        jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel16.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel16.setText("Supplier Information");

        jLabel17.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel17.setText("Supplier ID:");

        jLabel18.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel18.setText("Name:");

        jLabel19.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel19.setText("<html>Contact<br> Number/s:</html>");

        txtSAddress.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSAddress.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        txtSAddress.setEnabled(false);

        txtSConNum.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSConNum.setEnabled(false);

        txtSID.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSID.setEnabled(false);

        jLabel20.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel20.setText("Address:");

        txtSName.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSName.setEnabled(false);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(93, 93, 93)
                        .addComponent(jLabel16))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                        .addComponent(txtSConNum, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel17)
                            .addComponent(jLabel20))
                        .addGap(20, 20, 20)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtSAddress, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
                            .addComponent(txtSID, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtSName)))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabel18)))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addComponent(jLabel16)
                .addGap(56, 56, 56)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel17)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(1, 1, 1)
                        .addComponent(txtSID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(17, 17, 17)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(txtSName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(17, 17, 17)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(txtSAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtSConNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(127, 127, 127))
        );

        listSuppliers.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        listSuppliers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane3.setViewportView(listSuppliers);

        jLabel22.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel22.setText("List of Suppliers:");

        txtSupp.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtSupp.setText("Type a keyword");

        cbxSuppSearchBy.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxSuppSearchBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Name", "Address", "Contact Number/s" }));

        btnSuppSearch.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnSuppSearch.setText("Search");
        btnSuppSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSuppSearchActionPerformed(evt);
            }
        });

        btnSuppToCSV.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15)); // NOI18N
        btnSuppToCSV.setText("CREATE CSV");
        btnSuppToCSV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSuppToCSVActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelSupplierLayout = new javax.swing.GroupLayout(panelSupplier);
        panelSupplier.setLayout(panelSupplierLayout);
        panelSupplierLayout.setHorizontalGroup(
            panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelSupplierLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(panelSupplierLayout.createSequentialGroup()
                        .addGap(270, 270, 270)
                        .addComponent(btnSuppAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29)
                        .addComponent(btnSuppEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnSuppToCSV))
                    .addGroup(panelSupplierLayout.createSequentialGroup()
                        .addGroup(panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(panelSupplierLayout.createSequentialGroup()
                                    .addComponent(txtSupp, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(cbxSuppSearchBy, 0, 0, Short.MAX_VALUE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(btnSuppSearch)))
                            .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.LEADING))
                        .addGap(18, 18, 18)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(25, Short.MAX_VALUE))
        );
        panelSupplierLayout.setVerticalGroup(
            panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelSupplierLayout.createSequentialGroup()
                .addContainerGap(35, Short.MAX_VALUE)
                .addComponent(jLabel22)
                .addGap(18, 18, 18)
                .addGroup(panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelSupplierLayout.createSequentialGroup()
                        .addGroup(panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSupp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cbxSuppSearchBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnSuppSearch))
                        .addGap(14, 14, 14)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE))
                .addGroup(panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelSupplierLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(panelSupplierLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnSuppAdd)
                            .addComponent(btnSuppEdit)))
                    .addGroup(panelSupplierLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSuppToCSV)))
                .addContainerGap())
        );

        tabMainMenu.addTab("Supplier", panelSupplier);

        panelTransactions.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        tabTransactions.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        tabTransactions.setInheritsPopupMenu(true);

        panelReleases.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));

        jPanel11.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel69.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel69.setText("Customer Transaction Information");

        jLabel70.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel70.setText("Date:");

        txtTRID.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtTRID.setEnabled(false);

        jLabel71.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel71.setText("Customer:");

        jLabel72.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel72.setText("Status:");

        txtTRDate.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtTRDate.setEnabled(false);

        jLabel73.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel73.setText("Order ID:");

        txtTRName.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtTRName.setEnabled(false);

        jLabel74.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel74.setText("Customer Orders:");

        tableTROrders.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"", "", "", null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Serial Number", "Brand", "Model", "Quantity", "HP", "Price"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableTROrders.setEnabled(false);
        jScrollPane11.setViewportView(tableTROrders);
        tableTROrders.getColumnModel().getColumn(0).setResizable(false);
        tableTROrders.getColumnModel().getColumn(0).setPreferredWidth(55);
        tableTROrders.getColumnModel().getColumn(1).setResizable(false);
        tableTROrders.getColumnModel().getColumn(1).setPreferredWidth(50);
        tableTROrders.getColumnModel().getColumn(2).setResizable(false);
        tableTROrders.getColumnModel().getColumn(2).setPreferredWidth(55);
        tableTROrders.getColumnModel().getColumn(3).setResizable(false);
        tableTROrders.getColumnModel().getColumn(3).setPreferredWidth(5);
        tableTROrders.getColumnModel().getColumn(4).setResizable(false);
        tableTROrders.getColumnModel().getColumn(4).setPreferredWidth(3);
        tableTROrders.getColumnModel().getColumn(5).setResizable(false);
        tableTROrders.getColumnModel().getColumn(5).setPreferredWidth(50);

        jLabel75.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel75.setText("Total Price:");

        labelTRTotalPrice.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        labelTRTotalPrice.setText("<totalPrice>");

        cbxTRStatus.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxTRStatus.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pending", "Delivered" }));
        cbxTRStatus.setEnabled(false);

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel11Layout.createSequentialGroup()
                                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel11Layout.createSequentialGroup()
                                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel73)
                                            .addComponent(jLabel71)
                                            .addComponent(jLabel70)
                                            .addComponent(jLabel72))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(cbxTRStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(txtTRID, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(txtTRName, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
                                                .addComponent(txtTRDate, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE))))
                                    .addComponent(jLabel74))
                                .addGap(107, 107, 107))
                            .addGroup(jPanel11Layout.createSequentialGroup()
                                .addComponent(jLabel75)
                                .addGap(18, 18, 18)
                                .addComponent(labelTRTotalPrice))
                            .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
                        .addComponent(jLabel69)
                        .addGap(46, 46, 46))))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addComponent(jLabel69)
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel73)
                    .addComponent(txtTRID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel71)
                    .addComponent(txtTRName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel70)
                    .addComponent(txtTRDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel72)
                    .addComponent(cbxTRStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jLabel74)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelTRTotalPrice)
                    .addComponent(jLabel75))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        listReleases.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        listReleases.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "1 - Ace Water Spa", "2 - Star Paper Corp.", "3 - Gerry's Grill - Trinoma" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        listReleases.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane12.setViewportView(listReleases);

        jLabel77.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel77.setText("List of Releases:");

        cbxSearchByTRStatus.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxSearchByTRStatus.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All Releases", "Pending", "Delivered" }));

        jLabel78.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel78.setText("Release Status:");

        btnTRAdd.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnTRAdd.setText("Add");
        btnTRAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTRAddActionPerformed(evt);
            }
        });

        btnTREdit.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnTREdit.setText("Edit");
        btnTREdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTREditActionPerformed(evt);
            }
        });

        btnTRToCSV.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15)); // NOI18N
        btnTRToCSV.setText("CREATE CSV");
        btnTRToCSV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TRToCSVActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelReleasesLayout = new javax.swing.GroupLayout(panelReleases);
        panelReleases.setLayout(panelReleasesLayout);
        panelReleasesLayout.setHorizontalGroup(
            panelReleasesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelReleasesLayout.createSequentialGroup()
                .addGroup(panelReleasesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelReleasesLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(panelReleasesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel78)
                            .addGroup(panelReleasesLayout.createSequentialGroup()
                                .addGap(1, 1, 1)
                                .addComponent(jLabel77))
                            .addComponent(cbxSearchByTRStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(panelReleasesLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelReleasesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(panelReleasesLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(btnTRAdd)
                        .addGap(35, 35, 35)
                        .addComponent(btnTREdit)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 185, Short.MAX_VALUE)
                        .addComponent(btnTRToCSV)))
                .addContainerGap())
        );
        panelReleasesLayout.setVerticalGroup(
            panelReleasesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelReleasesLayout.createSequentialGroup()
                .addGroup(panelReleasesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(panelReleasesLayout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addComponent(jLabel78)
                        .addGap(11, 11, 11)
                        .addComponent(cbxSearchByTRStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(7, 7, 7)
                        .addComponent(jLabel77)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane12))
                    .addGroup(panelReleasesLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelReleasesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnTRAdd)
                    .addComponent(btnTREdit)
                    .addComponent(btnTRToCSV))
                .addContainerGap())
        );

        tabTransactions.addTab("Releases", panelReleases);

        panelPurchases.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        panelPurchases.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnTPAdd.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnTPAdd.setText("Add");
        btnTPAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTPAddActionPerformed(evt);
            }
        });
        panelPurchases.add(btnTPAdd, new org.netbeans.lib.awtextra.AbsoluteConstraints(281, 472, -1, -1));

        jLabel37.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel37.setText("Purchase Status:");
        panelPurchases.add(jLabel37, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 14, -1, -1));

        cbxSearchByTPStatus.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxSearchByTPStatus.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All Purchases", "Pending", "Delivered" }));
        panelPurchases.add(cbxSearchByTPStatus, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 49, 244, -1));

        jLabel44.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel44.setText("List of Purchases:");
        panelPurchases.add(jLabel44, new org.netbeans.lib.awtextra.AbsoluteConstraints(11, 81, -1, -1));

        listPurchases.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        listPurchases.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "1 - New Ever Lumber And Hardware", "2 - 3 Gold Marketing Corporation", "3 - To Suy" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        listPurchases.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane7.setViewportView(listPurchases);

        panelPurchases.add(jScrollPane7, new org.netbeans.lib.awtextra.AbsoluteConstraints(11, 111, 250, 350));

        jPanel8.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel45.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel45.setText("Company Purchase Information");

        txtTPDate.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtTPDate.setEnabled(false);

        jLabel46.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel46.setText("Status:");

        jLabel47.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel47.setText("Company Orders:");

        jLabel48.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel48.setText("Purchase ID:");

        jLabel49.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel49.setText("Supplier:");

        tableTPOrders.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"", null, "", null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Item", "Quantity", "Unit", "Price"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Float.class, java.lang.String.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableTPOrders.setEnabled(false);
        jScrollPane8.setViewportView(tableTPOrders);
        tableTPOrders.getColumnModel().getColumn(0).setResizable(false);
        tableTPOrders.getColumnModel().getColumn(0).setPreferredWidth(200);
        tableTPOrders.getColumnModel().getColumn(1).setResizable(false);
        tableTPOrders.getColumnModel().getColumn(1).setPreferredWidth(10);
        tableTPOrders.getColumnModel().getColumn(2).setResizable(false);
        tableTPOrders.getColumnModel().getColumn(2).setPreferredWidth(10);
        tableTPOrders.getColumnModel().getColumn(3).setResizable(false);
        tableTPOrders.getColumnModel().getColumn(3).setPreferredWidth(50);

        txtTPName.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtTPName.setEnabled(false);

        txtTPID.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtTPID.setEnabled(false);

        jLabel50.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel50.setText("Date:");

        jLabel51.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel51.setText("Total Price:");

        labelTPTotalPrice.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        labelTPTotalPrice.setText("<totalPrice>");

        cbxTPStatus.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxTPStatus.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pending", "Delivered" }));
        cbxTPStatus.setEnabled(false);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(79, 79, 79)
                        .addComponent(jLabel45))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel47))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE)
                            .addGroup(jPanel8Layout.createSequentialGroup()
                                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel48)
                                    .addComponent(jLabel49)
                                    .addComponent(jLabel50)
                                    .addComponent(jLabel46))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtTPName, javax.swing.GroupLayout.DEFAULT_SIZE, 331, Short.MAX_VALUE)
                                    .addComponent(txtTPID, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtTPDate, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cbxTPStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                        .addContainerGap(263, Short.MAX_VALUE)
                        .addComponent(jLabel51)
                        .addGap(18, 18, 18)
                        .addComponent(labelTPTotalPrice)))
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(jLabel45)
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel48)
                    .addComponent(txtTPID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel49)
                    .addComponent(txtTPName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel50)
                    .addComponent(txtTPDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel46)
                    .addComponent(cbxTPStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jLabel47)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelTPTotalPrice)
                    .addComponent(jLabel51))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelPurchases.add(jPanel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 10, 480, 450));

        btnTPEdit.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnTPEdit.setText("Edit");
        btnTPEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTPEditActionPerformed(evt);
            }
        });
        panelPurchases.add(btnTPEdit, new org.netbeans.lib.awtextra.AbsoluteConstraints(381, 472, -1, -1));

        btnTPToCSV.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15)); // NOI18N
        btnTPToCSV.setText("CREATE CSV");
        btnTPToCSV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTPToCSVActionPerformed(evt);
            }
        });
        panelPurchases.add(btnTPToCSV, new org.netbeans.lib.awtextra.AbsoluteConstraints(610, 470, -1, -1));

        tabTransactions.addTab("Purchases", panelPurchases);

        listMaterials.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        listMaterials.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Copper Tube S.D. 1/4\" x .022mm x 50'", "Copper Tube S.D. 3/8\" x .028mm x 50'", "Copper Tube S.D. 1/2\" x .028mm x 50'", "Copper Tube S.D. 5/8\" x .028mm x 50'", "Copper Tube S.D. 3/4\" x .028mm x 50'" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        listMaterials.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane13.setViewportView(listMaterials);

        jLabel79.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel79.setText("List of Materials:");

        jPanel12.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        tableMonitorItemPrices.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"", null},
                {"", null},
                {"", null},
                {null, null}
            },
            new String [] {
                "Date", "Price"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane14.setViewportView(tableMonitorItemPrices);
        tableMonitorItemPrices.getColumnModel().getColumn(0).setResizable(false);
        tableMonitorItemPrices.getColumnModel().getColumn(0).setPreferredWidth(50);
        tableMonitorItemPrices.getColumnModel().getColumn(1).setResizable(false);
        tableMonitorItemPrices.getColumnModel().getColumn(1).setPreferredWidth(50);

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane14, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane14, javax.swing.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE)
                .addContainerGap())
        );

        jLabel80.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel80.setText("Item Description:");

        txtItemDescription.setEditable(false);
        txtItemDescription.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtItemDescription.setText("Copper Tube S.D. 1/2\" x .028mm x 50'");

        javax.swing.GroupLayout panelMonitorItemPricesLayout = new javax.swing.GroupLayout(panelMonitorItemPrices);
        panelMonitorItemPrices.setLayout(panelMonitorItemPricesLayout);
        panelMonitorItemPricesLayout.setHorizontalGroup(
            panelMonitorItemPricesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelMonitorItemPricesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelMonitorItemPricesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel79)
                    .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 328, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(panelMonitorItemPricesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtItemDescription, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                    .addComponent(jLabel80))
                .addContainerGap())
        );
        panelMonitorItemPricesLayout.setVerticalGroup(
            panelMonitorItemPricesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelMonitorItemPricesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelMonitorItemPricesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel79)
                    .addComponent(jLabel80))
                .addGap(18, 18, 18)
                .addGroup(panelMonitorItemPricesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelMonitorItemPricesLayout.createSequentialGroup()
                        .addComponent(txtItemDescription, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap(14, Short.MAX_VALUE))
        );

        tabTransactions.addTab("Monitor Item Prices", panelMonitorItemPrices);

        panelTransactions.add(tabTransactions, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 770, 540));

        tabMainMenu.addTab("Transactions", panelTransactions);

        jLabel30.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel30.setText("List of AirCon Units:");

        btnInsEdit.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnInsEdit.setText("Edit");
        btnInsEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInsEditActionPerformed(evt);
            }
        });

        jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel31.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel31.setText("AirCon Installation Information");

        txtInsID.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInsID.setEnabled(false);

        txtInsBrand.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInsBrand.setEnabled(false);

        txtInsModel.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInsModel.setEnabled(false);

        jLabel21.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel21.setText("Description:");

        txtInsHorsePower.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInsHorsePower.setEnabled(false);

        jLabel32.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel32.setText("Installation ID:");

        jLabel33.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel33.setText("Brand:");

        jLabel34.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel34.setText("Model:");

        tableInsItemsSet.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        tableInsItemsSet.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"", null, "", null},
                {"", null, "", null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Item", "Quantity", "Unit", "Price"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Float.class, java.lang.String.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableInsItemsSet.setEnabled(false);
        jScrollPane6.setViewportView(tableInsItemsSet);
        tableInsItemsSet.getColumnModel().getColumn(0).setResizable(false);
        tableInsItemsSet.getColumnModel().getColumn(0).setPreferredWidth(250);
        tableInsItemsSet.getColumnModel().getColumn(1).setResizable(false);
        tableInsItemsSet.getColumnModel().getColumn(1).setPreferredWidth(10);
        tableInsItemsSet.getColumnModel().getColumn(2).setResizable(false);
        tableInsItemsSet.getColumnModel().getColumn(2).setPreferredWidth(10);
        tableInsItemsSet.getColumnModel().getColumn(3).setResizable(false);
        tableInsItemsSet.getColumnModel().getColumn(3).setPreferredWidth(25);

        jLabel35.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel35.setText("Needed for installation:");

        jLabel39.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        jLabel39.setText("Horsepower:");

        txtInsDescription.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        txtInsDescription.setEnabled(false);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel32)
                            .addComponent(jLabel33)
                            .addComponent(jLabel34)
                            .addComponent(jLabel21))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtInsBrand, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtInsModel, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtInsID, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtInsHorsePower, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtInsDescription, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(61, 61, 61))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel31)
                        .addGap(75, 75, 75))))
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel39)
                .addContainerGap(356, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel35)
                .addContainerGap(269, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel31)
                .addGap(25, 25, 25)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel32)
                    .addComponent(txtInsID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel33)
                    .addComponent(txtInsBrand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtInsModel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel34))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(txtInsDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel39)
                    .addComponent(txtInsHorsePower, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addComponent(jLabel35)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        btnInsAdd.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15));
        btnInsAdd.setText("Add");
        btnInsAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInsAddActionPerformed(evt);
            }
        });

        listAirConUnits.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        listAirConUnits.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "FP-42CVSR016", "WCARP24EA", "WCARG010EC DLX" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        listAirConUnits.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane5.setViewportView(listAirConUnits);

        jLabel36.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 20));
        jLabel36.setText("Brands:");

        cbxSearchByBrand.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 15));
        cbxSearchByBrand.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All" }));

        btnInsToCSV.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 15)); // NOI18N
        btnInsToCSV.setText("CREATE CSV");
        btnInsToCSV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInsToCSVActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelInstallationLayout = new javax.swing.GroupLayout(panelInstallation);
        panelInstallation.setLayout(panelInstallationLayout);
        panelInstallationLayout.setHorizontalGroup(
            panelInstallationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelInstallationLayout.createSequentialGroup()
                .addGroup(panelInstallationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelInstallationLayout.createSequentialGroup()
                        .addGap(282, 282, 282)
                        .addComponent(btnInsAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(39, 39, 39)
                        .addComponent(btnInsEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 151, Short.MAX_VALUE)
                        .addComponent(btnInsToCSV))
                    .addGroup(panelInstallationLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(panelInstallationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelInstallationLayout.createSequentialGroup()
                                .addComponent(jLabel36)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(cbxSearchByBrand, javax.swing.GroupLayout.Alignment.TRAILING, 0, 269, Short.MAX_VALUE)
                            .addComponent(jLabel30)
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 269, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(15, 15, 15))
        );
        panelInstallationLayout.setVerticalGroup(
            panelInstallationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInstallationLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel36)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelInstallationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelInstallationLayout.createSequentialGroup()
                        .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addGroup(panelInstallationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnInsAdd)
                            .addComponent(btnInsEdit)
                            .addComponent(btnInsToCSV)))
                    .addGroup(panelInstallationLayout.createSequentialGroup()
                        .addComponent(cbxSearchByBrand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel30)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        tabMainMenu.addTab("Installation", panelInstallation);

        tabMainMenu.setSelectedComponent(panelSU);

        dateDayTime.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12));
        dateDayTime.setText("Time");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tabMainMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 793, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(6, 6, 6)
                        .addComponent(lblUser)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnLogout)
                        .addGap(59, 59, 59)))
                .addContainerGap(10, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(218, Short.MAX_VALUE)
                .addComponent(dateDayTime, javax.swing.GroupLayout.PREFERRED_SIZE, 435, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(160, 160, 160))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblUser)
                        .addComponent(btnLogout)))
                .addGap(9, 9, 9)
                .addComponent(tabMainMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 588, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(dateDayTime, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void initializeItemList(){
        itemQuery=new ItemQuery(conn);
        items=itemQuery.initializeItems();
        DefaultListModel listModel = new DefaultListModel();
        for(int i=0;i<items.size();i++)
            listModel.addElement(items.get(i).getDescription());
        listItems.setModel(listModel);
        int j=listItems.getSelectedIndex()+1; //+1 because initially, nothing is selected (index is -1)
        txtInvDescription.setText(items.get(j).getDescription());
        txtInvID.setText(items.get(j).getID()+"");
        txtInvPrice.setText(items.get(j).getUnitPrice()+"");
        txtInvQuantity.setText(items.get(j).getQuantity()+"");
        int k=0;
        cbxInvUnit.setSelectedIndex(k);
        while(true){
            if(cbxInvUnit.getSelectedItem().toString().equals(items.get(j).getQuantityUnit()))
                break;
            else{
                k++;
                cbxInvUnit.setSelectedIndex(k);
            }
        }
        listItems.addListSelectionListener(new ListSelectionListener(){
            @Override
            public void valueChanged(ListSelectionEvent e){
                try{
                    int j=listItems.getSelectedIndex();
                    if(j==-1)
                        j++;
                    txtInvDescription.setText(items.get(j).getDescription());
                    txtInvID.setText(items.get(j).getID()+"");
                    txtInvPrice.setText(items.get(j).getUnitPrice()+"");
                    txtInvQuantity.setText(items.get(j).getQuantity()+"");
                    int k=0;
                    cbxInvUnit.setSelectedIndex(k);
                    while(true){
                        if(cbxInvUnit.getSelectedItem().toString().equals(items.get(j).getQuantityUnit()))
                            break;
                        else{
                            k++;
                            cbxInvUnit.setSelectedIndex(k);
                        }
                    }
                }catch(Exception f){f.printStackTrace();}
            }
        });
    } //end of initializeItemList() method
    private void initializeUserList(){
        userQuery=new UserQuery(conn);
        users=userQuery.initializeUsers();
        DefaultListModel listModel = new DefaultListModel();
        for(int i=0;i<users.size();i++)
            listModel.addElement(users.get(i).getFirstName() + " " + users.get(i).getLastName());
        listUsers.setModel(listModel);
        int j=listUsers.getSelectedIndex()+1; //+1 because initially, nothing is selected (index is -1)
        txtSUFirstname.setText(users.get(j).getFirstName());
        txtSULastname.setText(users.get(j).getLastName()+"");
        origFirstname=txtSUFirstname.getText();
        origLastname=txtSULastname.getText();
        txtSUUsername.setText(users.get(j).getUsername()+"");
        jPasswordField1.setText(users.get(j).getPassword()+"");
        int k=0;
        cbxSUPosition.setSelectedIndex(k);
        while(true){
            if(cbxSUPosition.getSelectedItem().toString().equals(users.get(j).getPosition()))
                break;
            else{
                k++;
                cbxSUPosition.setSelectedIndex(k);
            }
        }
        listUsers.addListSelectionListener(new ListSelectionListener(){
            @Override
            public void valueChanged(ListSelectionEvent e){
                try{
                    int j=listUsers.getSelectedIndex();
                    if(j==-1)
                        j++;
                    txtSUFirstname.setText(users.get(j).getFirstName());
                    txtSULastname.setText(users.get(j).getLastName());
                    origFirstname=txtSUFirstname.getText();
                    origLastname=txtSULastname.getText();
                    txtSUUsername.setText(users.get(j).getUsername()+"");
                    jPasswordField1.setText(users.get(j).getPassword()+"");
                    int k=0;
                    cbxSUPosition.setSelectedIndex(k);
                    while(true){
                        if(cbxSUPosition.getSelectedItem().toString().equals(users.get(j).getPosition()))
                            break;
                        else{
                            k++;
                            cbxSUPosition.setSelectedIndex(k);
                        }
                    }
                }catch(Exception f){f.printStackTrace();}
            }
        });
    } //end of initializeUserList() method
    private void initializeCustomerList(){
        customerQuery=new CustomerQuery(conn);
        customers=customerQuery.initializeCustomers();
        DefaultListModel listModel = new DefaultListModel();
        for(int i=0;i<customers.size();i++)
            listModel.addElement(customers.get(i).getName());
        listCustomers.setModel(listModel);
        int j=listCustomers.getSelectedIndex()+1; //+1 because initially, nothing is selected (index is -1)
        txtCName.setText(customers.get(j).getName());
        txtCID.setText(customers.get(j).getID()+"");
        txtCAddress.setText(customers.get(j).getAddress()+"");
        txtCConNum.setText(customers.get(j).getContactNumbers()+"");
        txtCRemarks.setText(customers.get(j).getRemarks()+"");
        listCustomers.addListSelectionListener(new ListSelectionListener(){
            @Override
            public void valueChanged(ListSelectionEvent e){
                try{
                    int j=listCustomers.getSelectedIndex();
                    if(j==-1)
                        j++;
                    txtCName.setText(customers.get(j).getName());
                    txtCID.setText(customers.get(j).getID()+"");
                    txtCAddress.setText(customers.get(j).getAddress()+"");
                    txtCConNum.setText(customers.get(j).getContactNumbers()+"");
                    txtCRemarks.setText(customers.get(j).getRemarks()+"");
                }catch(Exception f){f.printStackTrace();}
            }
        });
    } //end of initializeCustomerList() method
    private void initializeSupplierList(){
        supplierQuery=new SupplierQuery(conn);
        suppliers=supplierQuery.initializeSuppliers();
        DefaultListModel listModel = new DefaultListModel();
        for(int i=0;i<suppliers.size();i++)
            listModel.addElement(suppliers.get(i).getName());
        listSuppliers.setModel(listModel);
        int j=listSuppliers.getSelectedIndex()+1; //+1 because initially, nothing is selected (index is -1)
        txtSName.setText(suppliers.get(j).getName());
        txtSID.setText(suppliers.get(j).getID()+"");
        txtSAddress.setText(suppliers.get(j).getAddress()+"");
        txtSConNum.setText(suppliers.get(j).getContactNumbers()+"");
        listSuppliers.addListSelectionListener(new ListSelectionListener(){
            @Override
            public void valueChanged(ListSelectionEvent e){
                try{
                    int j=listSuppliers.getSelectedIndex();
                    if(j==-1)
                        j++;
                    txtSName.setText(suppliers.get(j).getName());
                    txtSID.setText(suppliers.get(j).getID()+"");
                    txtSAddress.setText(suppliers.get(j).getAddress()+"");
                    txtSConNum.setText(suppliers.get(j).getContactNumbers()+"");
                }catch(Exception f){f.printStackTrace();}
            }
        });
    } //end of initializeSupplierList() method
    private void initializeReleaseList(){
        initializeReleaseTable();
        releaseQuery=new TransactionReleaseQuery(conn);
        orders=releaseQuery.initializeReleases();
        cbxSearchByTRStatus.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    TRStatus=cbxSearchByTRStatus.getSelectedItem().toString();
                }catch(Exception e){}
                if(TRStatus.equals("All Releases"))
                    orders=releaseQuery.initializeReleases();
                else
                    orders=releaseQuery.search(TRStatus);
                DefaultListModel listModel = new DefaultListModel();
                try{
                    for(int i=0;i<orders.size();i++)
                        listModel.addElement(orders.get(i).getOrderID() + " - " + orders.get(i).getCustomerName());
                    listReleases.setModel(listModel);
                }catch(Exception e){
                    orders=releaseQuery.initializeReleases();
                    for(int i=0;i<orders.size();i++)
                        listModel.addElement(orders.get(i).getOrderID() + " - " + orders.get(i).getCustomerName());
                    listReleases.setModel(listModel);
                }
            }
        });
        DefaultListModel listModel = new DefaultListModel();
        for(int i=0;i<orders.size();i++)
            listModel.addElement(orders.get(i).getOrderID() + " - " + orders.get(i).getCustomerName());
        listReleases.setModel(listModel);
        order=releaseQuery.search(orders.get(0).getOrderID());
        txtTRID.setText(order.getOrderID()+"");
        txtTRName.setText(order.getCustomerName());
        txtTRDate.setText(order.getDate().toString());
        cbxTRStatus.setSelectedItem(order.getStatus());
        while(modelTR.getRowCount()!=0)
            modelTR.removeRow(0);
        float totalPrice=0;
        for(int i=0;i<order.getSerialNumbers().size();i++){
            Object[] rowData=new Object[6];
            rowData[0]=order.getSerialNumbers().get(i);
            rowData[1]=order.getBrands().get(i);
            rowData[2]=order.getModels().get(i);
            rowData[3]=order.getQuantities().get(i);
            rowData[4]=order.getHorsePowers().get(i);
            rowData[5]=order.getPrices().get(i);
            modelTR.insertRow(i,rowData);
            totalPrice+=order.getQuantities().get(i)*order.getPrices().get(i);
        }
        labelTRTotalPrice.setText((new Float(totalPrice)).toString());
        tableTROrders.setModel(modelTR);
        listReleases.addListSelectionListener(new ListSelectionListener(){
            @Override
            public void valueChanged(ListSelectionEvent e){
                try{
                    try{
                        order=releaseQuery.search(orders.get(listReleases.getSelectedIndex()).getOrderID());
                    }
                    catch(Exception f){
                        order=releaseQuery.search(orders.get(0).getOrderID());
                    }
                    txtTRID.setText(order.getOrderID()+"");
                    txtTRName.setText(order.getCustomerName());
                    try{
                        txtTRDate.setText(order.getDate().toString());
                    }catch(Exception f){}
                    cbxTRStatus.setSelectedItem(order.getStatus());
                    while(modelTR.getRowCount()!=0)
                        modelTR.removeRow(0);
                    float totalPrice=0;
                    for(int i=0;i<order.getSerialNumbers().size();i++){
                        Object[] rowData=new Object[6];
                        rowData[0]=order.getSerialNumbers().get(i);
                        rowData[1]=order.getBrands().get(i);
                        rowData[2]=order.getModels().get(i);
                        rowData[3]=order.getQuantities().get(i);
                        rowData[4]=order.getHorsePowers().get(i);
                        rowData[5]=order.getPrices().get(i);
                        modelTR.insertRow(i,rowData);
                        totalPrice+=order.getQuantities().get(i)*order.getPrices().get(i);
                    }
                    labelTRTotalPrice.setText((new Float(totalPrice)).toString());
                    tableTROrders.setModel(modelTR);
                }catch(Exception f){f.printStackTrace();}
            }
        });
    } //end of initializeReleaseList() method
    private void initializePurchaseList(){
        initializePurchaseTable();
        purchaseQuery=new TransactionPurchaseQuery(conn);
        purchases=purchaseQuery.initializePurchases();
        cbxSearchByTPStatus.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    TPStatus=cbxSearchByTPStatus.getSelectedItem().toString();
                }catch(Exception e){}
                if(TPStatus.equals("All Purchases"))
                    purchases=purchaseQuery.initializePurchases();
                else
                    purchases=purchaseQuery.search(TPStatus);
                DefaultListModel listModel = new DefaultListModel();
                try{
                    for(int i=0;i<purchases.size();i++)
                        listModel.addElement(purchases.get(i).getPurchaseID() + " - " + purchases.get(i).getSupplierName());
                    listPurchases.setModel(listModel);
                }catch(Exception e){
                    purchases=purchaseQuery.initializePurchases();
                    for(int i=0;i<purchases.size();i++)
                        listModel.addElement(purchases.get(i).getPurchaseID() + " - " + purchases.get(i).getSupplierName());
                    listPurchases.setModel(listModel);
                }
            }
        });
        DefaultListModel listModel = new DefaultListModel();
        for(int i=0;i<purchases.size();i++)
            listModel.addElement(purchases.get(i).getPurchaseID() + " - " + purchases.get(i).getSupplierName());
        listPurchases.setModel(listModel);
        purchase=purchaseQuery.search(purchases.get(0).getPurchaseID());
        txtTPID.setText(purchase.getPurchaseID()+"");
        txtTPName.setText(purchase.getSupplierName());
        txtTPDate.setText(purchase.getDate().toString());
        cbxTPStatus.setSelectedItem(purchase.getStatus());
        while(modelTP.getRowCount()!=0)
            modelTP.removeRow(0);
        float totalPrice=0;
        for(int i=0;i<purchase.getIDs().size();i++){
            Object[] rowData=new Object[4];
            rowData[0]=purchase.getItemNames().get(i);
            rowData[1]=purchase.getQuantities().get(i);
            rowData[2]=purchase.getUnits().get(i);
            rowData[3]=purchase.getPrices().get(i);
            modelTP.insertRow(i,rowData);
            totalPrice+=purchase.getQuantities().get(i)*purchase.getPrices().get(i);
        }
        labelTPTotalPrice.setText((new Float(totalPrice)).toString());
        tableTPOrders.setModel(modelTP);
        listPurchases.addListSelectionListener(new ListSelectionListener(){
            @Override
            public void valueChanged(ListSelectionEvent e){
                try{
                    try{
                        purchase=purchaseQuery.search(purchases.get(listPurchases.getSelectedIndex()).getPurchaseID());
                    }
                    catch(Exception f){
                        purchase=purchaseQuery.search(purchases.get(0).getPurchaseID());
                    }
                    txtTPID.setText(purchase.getPurchaseID()+"");
                    txtTPName.setText(purchase.getSupplierName());
                    try{
                        txtTPDate.setText(purchase.getDate().toString());
                    }catch(Exception f){}
                    cbxTPStatus.setSelectedItem(purchase.getStatus());
                    while(modelTP.getRowCount()!=0)
                        modelTP.removeRow(0);
                    float totalPrice=0;
                    for(int i=0;i<purchase.getIDs().size();i++){
                        Object[] rowData=new Object[4];
                        rowData[0]=purchase.getItemNames().get(i);
                        rowData[1]=purchase.getQuantities().get(i);
                        rowData[2]=purchase.getUnits().get(i);
                        rowData[3]=purchase.getPrices().get(i);
                        modelTP.insertRow(i,rowData);
                        totalPrice+=purchase.getQuantities().get(i)*purchase.getPrices().get(i);
                    }
                    labelTPTotalPrice.setText((new Float(totalPrice)).toString());
                    tableTPOrders.setModel(modelTP);
                }catch(Exception f){f.printStackTrace();}
            }
        });
    } //end of initializePurchaseList() method
    private void initializeMaterialList(){
        initializeMonitorItemPricesTable();
        materials=itemQuery.initializeItems();
        DefaultListModel listModel = new DefaultListModel();
        for(int i=0;i<materials.size();i++)
            listModel.addElement(materials.get(i).getDescription());
        listMaterials.setModel(listModel);
        int j=listMaterials.getSelectedIndex()+1; //+1 because initially, nothing is selected (index is -1)
        txtItemDescription.setText(materials.get(j).getDescription());
        while(modelMIP.getRowCount()!=0)
            modelMIP.removeRow(0);
        List<TransactionPurchase> purchases=purchaseQuery.searchItem(txtItemDescription.getText());
        for(int i=0;i<purchases.size();i++){
            Object[] rowData=new Object[4];
            try{
                rowData[0]=purchases.get(i).getDate();
                rowData[1]=purchases.get(i).getPrice();
            }catch(Exception e){}
            modelMIP.insertRow(i,rowData);
        }
        tableMonitorItemPrices.setModel(modelMIP);
        listMaterials.addListSelectionListener(new ListSelectionListener(){
            @Override
            public void valueChanged(ListSelectionEvent e){
                try{
                    int j=listMaterials.getSelectedIndex();
                    if(j==-1)
                        j++;
                    txtItemDescription.setText(materials.get(j).getDescription());
                    while(modelMIP.getRowCount()!=0)
                        modelMIP.removeRow(0);
                    List<TransactionPurchase> purchases=purchaseQuery.searchItem(txtItemDescription.getText());
                    for(int i=0;i<purchases.size();i++){
                        Object[] rowData=new Object[4];
                        try{
                            rowData[0]=purchases.get(i).getDate();
                            rowData[1]=purchases.get(i).getPrice();
                            modelMIP.insertRow(i,rowData);
                        }catch(Exception f){}
                    }
                    tableMonitorItemPrices.setModel(modelMIP);
                }catch(Exception f){f.printStackTrace();}
            }
        });
    } //end of initializeMaterialList() method
    private void initializeAirConList(){
        initializeAirconTable();
        installationQuery=new InstallationQuery(conn);
        installations=installationQuery.initializeInstallations();
        ArrayList<String> temp=new ArrayList<String>();
        cbxSearchByBrand.removeAllItems();
        cbxSearchByBrand.addItem("All");
        for(int i=0;i<installations.size();i++)
            if(!temp.contains(installations.get(i).getBrand())){
                cbxSearchByBrand.addItem(installations.get(i).getBrand());
                temp.add(installations.get(i).getBrand());
            } //assures no duplicate brands will appear in dropdown list
        cbxSearchByBrand.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    brand=cbxSearchByBrand.getSelectedItem().toString();
                }catch(Exception e){}
                if(brand.equals("All"))
                    installations=installationQuery.initializeInstallations();
                else
                    installations=installationQuery.search(brand);
                DefaultListModel listModel = new DefaultListModel();
                try{
                    for(int i=0;i<installations.size();i++)
                        listModel.addElement(installations.get(i).getModel());
                    listAirConUnits.setModel(listModel);
                }catch(Exception e){
                    installations=installationQuery.initializeInstallations();
                    for(int i=0;i<installations.size();i++)
                        listModel.addElement(installations.get(i).getModel());
                    listAirConUnits.setModel(listModel);
                }
            }
        });
        DefaultListModel listModel = new DefaultListModel();
        for(int i=0;i<installations.size();i++)
            listModel.addElement(installations.get(i).getModel());
        listAirConUnits.setModel(listModel);
        installation=installationQuery.search(installations.get(0).getBrand(),installations.get(0).getModel());
        txtInsID.setText(installation.getInstallationID()+"");
        txtInsBrand.setText(installation.getBrand());
        txtInsModel.setText(installation.getModel());
        txtInsDescription.setText(installation.getDescription());
        txtInsHorsePower.setText(installation.getHorsePower()+"");
        while(modelAircon.getRowCount()!=0)
            modelAircon.removeRow(0);
        for(int i=0;i<installation.getIDs().size();i++){
            Object[] rowData=new Object[4];
            rowData[0]=installation.getItemNames().get(i);
            rowData[1]=installation.getQuantities().get(i);
            rowData[2]=installation.getUnits().get(i);
            rowData[3]=installation.getPrices().get(i);
            modelAircon.insertRow(i,rowData);
        }
        tableInsItemsSet.setModel(modelAircon);
        listAirConUnits.addListSelectionListener(new ListSelectionListener(){
            @Override
            public void valueChanged(ListSelectionEvent e){
                try{
                    try{
                        if(brand.equals("All"))
                            installation=installationQuery.search(installations.get(listAirConUnits.getSelectedIndex()).getBrand(),listAirConUnits.getSelectedValue().toString());
                        else
                            installation=installationQuery.search(brand, listAirConUnits.getSelectedValue().toString());
                    }
                    catch(Exception f){
                        installation=installationQuery.search(brand,installations.get(0).getModel());
                    }
                    txtInsID.setText(installation.getInstallationID()+"");
                    txtInsBrand.setText(installation.getBrand());
                    txtInsModel.setText(installation.getModel());
                    txtInsDescription.setText(installation.getDescription());
                    txtInsHorsePower.setText(installation.getHorsePower()+"");
                    while(modelAircon.getRowCount()!=0)
                        modelAircon.removeRow(0);
                    for(int i=0;i<installation.getIDs().size();i++){
                        Object[] rowData=new Object[4];
                        rowData[0]=installation.getItemNames().get(i);
                        rowData[1]=installation.getQuantities().get(i);
                        rowData[2]=installation.getUnits().get(i);
                        rowData[3]=installation.getPrices().get(i);
                        modelAircon.insertRow(i,rowData);
                    }
                    tableInsItemsSet.setModel(modelAircon);
                }catch(Exception f){f.printStackTrace();}
            }
        });
    } //end of initializeAirConList() method
    private void initializeAirconTable(){
        String data[][] = {};
        String col[] = {"Item", "Quantity", "Unit", "Price"};
        modelAircon = new DefaultTableModel(data, col){
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Float.class, java.lang.String.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };
            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        };
        tableInsItemsSet.setModel(modelAircon);
        tableInsItemsSet.getColumnModel().getColumn(0).setResizable(false);
        tableInsItemsSet.getColumnModel().getColumn(0).setPreferredWidth(250);
        tableInsItemsSet.getColumnModel().getColumn(1).setResizable(false);
        tableInsItemsSet.getColumnModel().getColumn(1).setPreferredWidth(10);
        tableInsItemsSet.getColumnModel().getColumn(2).setResizable(false);
        tableInsItemsSet.getColumnModel().getColumn(2).setPreferredWidth(10);
        tableInsItemsSet.getColumnModel().getColumn(3).setResizable(false);
        tableInsItemsSet.getColumnModel().getColumn(3).setPreferredWidth(20);
    } //end of initializeAirconTable() method
    private void initializePurchaseTable(){
        String data[][] = {};
        String col[] = {"Item", "Quantity", "Unit", "Price"};
        modelTP = new DefaultTableModel(data, col){
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Float.class, java.lang.String.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };
            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        };
        tableTPOrders.setModel(modelTP);
        tableTPOrders.getColumnModel().getColumn(0).setResizable(false);
        tableTPOrders.getColumnModel().getColumn(0).setPreferredWidth(200);
        tableTPOrders.getColumnModel().getColumn(1).setResizable(false);
        tableTPOrders.getColumnModel().getColumn(1).setPreferredWidth(10);
        tableTPOrders.getColumnModel().getColumn(2).setResizable(false);
        tableTPOrders.getColumnModel().getColumn(2).setPreferredWidth(10);
        tableTPOrders.getColumnModel().getColumn(3).setResizable(false);
        tableTPOrders.getColumnModel().getColumn(3).setPreferredWidth(50);
    } //end of initializeReleaseTable() method
    private void initializeReleaseTable(){
        String data[][] = {};
        String col[] = {"Serial Number", "Brand", "Model", "Quantity", "HP", "Price"};
        modelTR = new DefaultTableModel(data, col){
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Float.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };
            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        };
        tableTROrders.setModel(modelTR);
        tableTROrders.getColumnModel().getColumn(0).setResizable(false);
        tableTROrders.getColumnModel().getColumn(0).setPreferredWidth(55);
        tableTROrders.getColumnModel().getColumn(1).setResizable(false);
        tableTROrders.getColumnModel().getColumn(1).setPreferredWidth(50);
        tableTROrders.getColumnModel().getColumn(2).setResizable(false);
        tableTROrders.getColumnModel().getColumn(2).setPreferredWidth(55);
        tableTROrders.getColumnModel().getColumn(3).setResizable(false);
        tableTROrders.getColumnModel().getColumn(3).setPreferredWidth(5);
        tableTROrders.getColumnModel().getColumn(4).setResizable(false);
        tableTROrders.getColumnModel().getColumn(4).setPreferredWidth(3);
        tableTROrders.getColumnModel().getColumn(5).setResizable(false);
        tableTROrders.getColumnModel().getColumn(5).setPreferredWidth(50);
    } //end of initializePurchaseTable() method
    private void initializeMonitorItemPricesTable(){
        String data[][] = {};
        String col[] = {"Date", "Price"};
        modelMIP = new DefaultTableModel(data, col){
            Class[] types = new Class [] {
                java.util.Date.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false
            };
            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        };
        tableMonitorItemPrices.setModel(modelTP);
        tableMonitorItemPrices.getColumnModel().getColumn(0).setResizable(false);
        tableMonitorItemPrices.getColumnModel().getColumn(0).setPreferredWidth(50);
        tableMonitorItemPrices.getColumnModel().getColumn(1).setResizable(false);
        tableMonitorItemPrices.getColumnModel().getColumn(1).setPreferredWidth(50);
    } //end of initializeMonitorItemPricesTable() method
    private boolean checkNumber(String number){
        if(number.length()==7||number.length()==11){
            for(int i=0;i<number.length();i++)
                if(number.charAt(i)=='1' || number.charAt(i)=='2' || number.charAt(i)=='3' || number.charAt(i)=='4' || number.charAt(i)=='5' || number.charAt(i)=='6' || number.charAt(i)=='7' || number.charAt(i)=='8' || number.charAt(i)=='9' || number.charAt(i)=='0')
                    ;
                else
                    return false;
        }
        else
            return false;
        return true;
    }
    private void logoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutActionPerformed
        JOptionPane pane=new JOptionPane("Are you sure you want to logout?");
        Object[] options=new String[]{"Yes","No"};
        pane.setOptions(options);
        JDialog dialog = pane.createDialog(new JFrame(), "Logout?");
        dialog.show();
        if(options[0].equals(pane.getValue())) //YES
            backToLogin=true;
    }//GEN-LAST:event_logoutActionPerformed

    private void btnSUAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSUAddActionPerformed
        hide=true;
        addUserFrame=new JFrame("Add a System User");
        addUser=new AddUser(conn, screenWidth, screenHeight);
        addUserFrame.add(addUser);
        addUserFrame.setSize(addUser.getWidth(), addUser.getHeight());
        addUserFrame.setLocation((screenWidth-addUser.getWidth())/2,(screenHeight-addUser.getHeight())/2);
        addUserFrame.setResizable(false);
        addUserFrame.setVisible(true);
        addUserFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(addUser.backToMainMenu){
                        addUserFrame.dispose();
                        addUser=new AddUser(conn, screenWidth, screenHeight);
                        hide=false;
                        initializeUserList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }//GEN-LAST:event_btnSUAddActionPerformed

    private void btnSUEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSUEditActionPerformed
        if(btnSUEdit.getText().equals("Edit")){
            btnSUAdd.setEnabled(false);
            btnSUEdit.setText("Save");
            cbxSUPosition.setEnabled(true);
            txtSUFirstname.setEnabled(true);
            txtSULastname.setEnabled(true);
            txtSUUsername.setEnabled(true);
            jPasswordField1.setEnabled(true);
            jLabel38.setVisible(true);
            jPasswordField2.setVisible(true);
            jPasswordField2.setText(jPasswordField1.getText());
            listUsers.setEnabled(false);
            btnSUSearch.setEnabled(false);
        }
        else{
            userQuery=new UserQuery(conn);
            userQuery.interpretSearchBy(cbxSUSearchBy.getSelectedIndex());
            if(txtSUFirstname.getText().equals("") || txtSULastname.getText().equals("") || txtSUUsername.getText().equals("") || jPasswordField1.getText().equals(""))
                JOptionPane.showMessageDialog(null, "All fields cannot be empty!");
            else if(jPasswordField1.getText().length()<6)
                JOptionPane.showMessageDialog(null, "Password too short!");
            else if(!jPasswordField1.getText().equals(jPasswordField2.getText()))
                JOptionPane.showMessageDialog(null, "The passwords do not match!");
            else{
                userQuery.editUser(txtSUFirstname.getText(),txtSULastname.getText(),SUPosition,txtSUUsername.getText(),jPasswordField1.getText(),origFirstname,origLastname);
                int j=listUsers.getSelectedIndex();
                DefaultListModel listModel = new DefaultListModel();
                users=userQuery.initializeUsers();
                for(int i=0;i<users.size();i++)
                    listModel.addElement(users.get(i).getFirstName() + " " + users.get(i).getLastName());
                listUsers.setModel(listModel);
                listUsers.setSelectedIndex(j); //update user list
                btnSUAdd.setEnabled(true);
                btnSUEdit.setText("Edit");
                cbxSUPosition.setEnabled(false);
                txtSUFirstname.setEnabled(false);
                txtSULastname.setEnabled(false);
                txtSUUsername.setEnabled(false);
                jPasswordField1.setEnabled(false);
                jLabel38.setVisible(false);
                jPasswordField2.setVisible(false);
                listUsers.setEnabled(true);
                btnSUSearch.setEnabled(true);
            }
        }
    }//GEN-LAST:event_btnSUEditActionPerformed

    private void btnInvAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInvAddActionPerformed
        hide=true;
        addItemFrame=new JFrame("Add an Item");
        addItem=new AddItem(conn, screenWidth, screenHeight);
        addItemFrame.add(addItem);
        addItemFrame.setSize(addItem.getWidth(), addItem.getHeight());
        addItemFrame.setLocation((screenWidth-addItem.getWidth())/2,(screenHeight-addItem.getHeight())/2);
        addItemFrame.setResizable(false);
        addItemFrame.setVisible(true);
        addItemFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(addItem.backToMainMenu){
                        addItemFrame.dispose();
                        addItem=new AddItem(conn, screenWidth, screenHeight);
                        hide=false;
                        initializeItemList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }//GEN-LAST:event_btnInvAddActionPerformed

    private void btnInvEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInvEditActionPerformed
        if(btnInvEdit.getText().equals("Edit")){
            btnInvAdd.setEnabled(false);
            btnInvEdit.setText("Save");
            txtInvDescription.setEnabled(true);
            txtInvQuantity.setEnabled(true);
            cbxInvUnit.setEnabled(true);
            txtInvPrice.setEnabled(true);
            listItems.setEnabled(false);
            btnInvSearch.setEnabled(false);
        }
        else{
            itemQuery=new ItemQuery(conn);
            itemQuery.interpretSearchBy(cbxInvSearchBy.getSelectedIndex());
            if(txtInvDescription.getText().equals("") || txtInvPrice.getText().equals("") || txtInvQuantity.getText().equals(""))
                JOptionPane.showMessageDialog(null, "All fields cannot be empty!");
            else if(Float.parseFloat(txtInvPrice.getText())<0 || Float.parseFloat(txtInvQuantity.getText())<0)
                JOptionPane.showMessageDialog(null, "No negative inputs!");
            else{
                itemQuery.editItem(Integer.parseInt(txtInvID.getText()),Float.parseFloat(txtInvQuantity.getText()),quantityUnit,txtInvDescription.getText(),Float.parseFloat(txtInvPrice.getText()));
                int j=listItems.getSelectedIndex();
                DefaultListModel listModel = new DefaultListModel();
                items=itemQuery.initializeItems();
                for(int i=0;i<items.size();i++)
                    listModel.addElement(items.get(i).getDescription());
                listItems.setModel(listModel);
                listItems.setSelectedIndex(j); //update item list
                btnInvAdd.setEnabled(true);
                btnInvEdit.setText("Edit");
                txtInvDescription.setEnabled(false);
                txtInvQuantity.setEnabled(false);
                cbxInvUnit.setEnabled(false);
                txtInvPrice.setEnabled(false);
                listItems.setEnabled(true);
                btnInvSearch.setEnabled(true);
            }
        }
    }//GEN-LAST:event_btnInvEditActionPerformed

    private void btnCustAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustAddActionPerformed
        hide=true;
        addCustomerFrame=new JFrame("Add a Customer");
        addCustomer=new AddCustomer(conn, screenWidth, screenHeight);
        addCustomerFrame.add(addCustomer);
        addCustomerFrame.setSize(addCustomer.getWidth(), addCustomer.getHeight());
        addCustomerFrame.setLocation((screenWidth-addCustomer.getWidth())/2,(screenHeight-addCustomer.getHeight())/2);
        addCustomerFrame.setResizable(false);
        addCustomerFrame.setVisible(true);
        addCustomerFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(addCustomer.backToMainMenu){
                        addCustomerFrame.dispose();
                        addCustomer=new AddCustomer(conn, screenWidth, screenHeight);
                        hide=false;
                        initializeCustomerList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }//GEN-LAST:event_btnCustAddActionPerformed

    private void btnCustEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustEditActionPerformed
        if(btnCustEdit.getText().equals("Edit")){
            btnCustAdd.setEnabled(false);
            btnCustEdit.setText("Save");
            txtCName.setEnabled(true);
            txtCAddress.setEnabled(true);
            txtCConNum.setEnabled(true);
            txtCRemarks.setEnabled(true);
            listCustomers.setEnabled(false);
            btnCustSearch.setEnabled(false);
        }
        else{
            customerQuery=new CustomerQuery(conn);
            customerQuery.interpretSearchBy(cbxCustSearchBy.getSelectedIndex());
            if(txtCName.getText().equals("") || txtCAddress.getText().equals("") || txtCConNum.getText().equals("") || txtCRemarks.getText().equals(""))
                JOptionPane.showMessageDialog(null, "All fields cannot be empty!");
            else if(!checkNumber(txtCConNum.getText()))
                JOptionPane.showMessageDialog(null, "Invalid phone number!");
            else{
                customerQuery.editCustomer(Integer.parseInt(txtCID.getText()),txtCName.getText(),txtCAddress.getText(),txtCConNum.getText(),txtCRemarks.getText());
                int j=listCustomers.getSelectedIndex();
                DefaultListModel listModel = new DefaultListModel();
                customers=customerQuery.initializeCustomers();
                for(int i=0;i<customers.size();i++)
                    listModel.addElement(customers.get(i).getName());
                listCustomers.setModel(listModel);
                listCustomers.setSelectedIndex(j); //update customer list
                btnCustAdd.setEnabled(true);
                btnCustEdit.setText("Edit");
                txtCName.setEnabled(false);
                txtCAddress.setEnabled(false);
                txtCConNum.setEnabled(false);
                txtCRemarks.setEnabled(false);
                listCustomers.setEnabled(true);
                btnCustSearch.setEnabled(true);
            }
        }
    }//GEN-LAST:event_btnCustEditActionPerformed

    private void btnTRAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTRAddActionPerformed
        hide=true;
        addTransactionReleaseFrame=new JFrame("Add a Transaction Release");
        addTransactionRelease=new AddTransactionRelease(conn, screenWidth, screenHeight);
        addTransactionReleaseFrame.add(addTransactionRelease);
        addTransactionReleaseFrame.setSize(addTransactionRelease.getWidth(), addTransactionRelease.getHeight());
        addTransactionReleaseFrame.setLocation((screenWidth-addTransactionRelease.getWidth())/2,(screenHeight-addTransactionRelease.getHeight())/2);
        addTransactionReleaseFrame.setResizable(false);
        addTransactionReleaseFrame.setVisible(true);
        addTransactionReleaseFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(addTransactionRelease.backToMainMenu){
                        addTransactionReleaseFrame.dispose();
                        addTransactionRelease=new AddTransactionRelease(conn, screenWidth, screenHeight);
                        hide=false;
                        initializeReleaseList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }//GEN-LAST:event_btnTRAddActionPerformed

    private void btnTREditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTREditActionPerformed
        if(order.getStatus().equals("Pending")){
        hide=true;
        editTransactionReleaseFrame=new JFrame("Edit a Transaction Release");
        try {
            editTransactionRelease = new EditTransactionRelease(conn, screenWidth, screenHeight, Integer.parseInt(txtTRID.getText()), order.getCustomerID(), txtTRName.getText(), (Date) order.getDate(), order.getStatus(), order.getSerialNumbers(), order.getQuantities(), order.getPrices(), order.getInstallationIDs(), order.getBrands(), order.getModels());
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
        }
        editTransactionReleaseFrame.add(editTransactionRelease);
        editTransactionReleaseFrame.setSize(editTransactionRelease.getWidth(), editTransactionRelease.getHeight());
        editTransactionReleaseFrame.setLocation((screenWidth-editTransactionRelease.getWidth())/2,(screenHeight-editTransactionRelease.getHeight())/2);
        editTransactionReleaseFrame.setResizable(false);
        editTransactionReleaseFrame.setVisible(true);
        editTransactionReleaseFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(editTransactionRelease.backToMainMenu){
                        editTransactionReleaseFrame.dispose();
                        editTransactionRelease=new EditTransactionRelease(conn, screenWidth, screenHeight, Integer.parseInt(txtTRID.getText()), order.getCustomerID(), txtTRName.getText(), (Date)order.getDate(), order.getStatus(), order.getSerialNumbers(), order.getQuantities(), order.getPrices(), order.getInstallationIDs(), order.getBrands(), order.getModels());
                        hide=false;
                        initializeReleaseList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
        }
        else
            JOptionPane.showMessageDialog(null, "Can't edit an already processed transaction!");
    }//GEN-LAST:event_btnTREditActionPerformed

    private void btnTPAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTPAddActionPerformed
        hide=true;
        addTransactionPurchaseFrame=new JFrame("Add a Company Purchase");
        addTransactionPurchase=new AddTransactionPurchase(conn, screenWidth, screenHeight);
        addTransactionPurchaseFrame.add(addTransactionPurchase);
        addTransactionPurchaseFrame.setSize(addTransactionPurchase.getWidth(), addTransactionPurchase.getHeight());
        addTransactionPurchaseFrame.setLocation((screenWidth-addTransactionPurchase.getWidth())/2,(screenHeight-addTransactionPurchase.getHeight())/2);
        addTransactionPurchaseFrame.setResizable(false);
        addTransactionPurchaseFrame.setVisible(true);
        addTransactionPurchaseFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(addTransactionPurchase.backToMainMenu){
                        addTransactionPurchaseFrame.dispose();
                        addTransactionPurchase=new AddTransactionPurchase(conn, screenWidth, screenHeight);
                        hide=false;
                        initializePurchaseList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }//GEN-LAST:event_btnTPAddActionPerformed

    private void btnTPEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTPEditActionPerformed
        if(purchase.getStatus().equals("Pending")){
        modelTP=(DefaultTableModel)tableTPOrders.getModel();
        List<String> descriptions=new ArrayList<String>();
        List<Float> quantities=new ArrayList<Float>();
        List<String> units=new ArrayList<String>();
        List<Float> prices=new ArrayList<Float>();
        String[] rowData=new String[modelTP.getColumnCount()];
        for(int i=0;i<modelTP.getRowCount();i++){
            for(int j=0;j<modelTP.getColumnCount();j++)
                rowData[j]=modelTP.getValueAt(i, j).toString();
            descriptions.add(rowData[0]);
            quantities.add(Float.parseFloat(rowData[1]));
            units.add(rowData[2]);
            prices.add(Float.parseFloat(rowData[3]));
        } //get table values
        hide=true;
        editTransactionPurchaseFrame=new JFrame("Edit a Company Purchase");
        try {
            editTransactionPurchase = new EditTransactionPurchase(conn, screenWidth, screenHeight, Integer.parseInt(txtTPID.getText()), purchase.getSupplierID(), txtTPName.getText(), (Date)purchase.getDate(), purchase.getStatus(), purchase.getIDs(), purchase.getQuantities(), purchase.getUnits(), purchase.getItemIDs(), purchase.getItemNames(), purchase.getPrices());
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
        }
        editTransactionPurchaseFrame.add(editTransactionPurchase);
        editTransactionPurchaseFrame.setSize(editTransactionPurchase.getWidth(), editTransactionPurchase.getHeight());
        editTransactionPurchaseFrame.setLocation((screenWidth-editTransactionPurchase.getWidth())/2,(screenHeight-editTransactionPurchase.getHeight())/2);
        editTransactionPurchaseFrame.setResizable(false);
        editTransactionPurchaseFrame.setVisible(true);
        editTransactionPurchaseFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(editTransactionPurchase.backToMainMenu){
                        editTransactionPurchaseFrame.dispose();
                        editTransactionPurchase=new EditTransactionPurchase(conn, screenWidth, screenHeight, Integer.parseInt(txtTPID.getText()), purchase.getSupplierID(), txtTPName.getText(), (Date)purchase.getDate(), purchase.getStatus(), purchase.getIDs(), purchase.getQuantities(), purchase.getUnits(), purchase.getItemIDs(), purchase.getItemNames(), purchase.getPrices());
                        hide=false;
                        initializePurchaseList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
        }
        else
            JOptionPane.showMessageDialog(null, "Can't edit an already processed transaction!");
    }//GEN-LAST:event_btnTPEditActionPerformed

    private void btnInsAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsAddActionPerformed
        hide=true;
        addInstallationFrame=new JFrame("Add an Installation");
        addInstallation=new AddInstallation(conn, screenWidth, screenHeight);
        addInstallationFrame.add(addInstallation);
        addInstallationFrame.setSize(addInstallation.getWidth(), addInstallation.getHeight());
        addInstallationFrame.setLocation((screenWidth-addInstallation.getWidth())/2,(screenHeight-addInstallation.getHeight())/2);
        addInstallationFrame.setResizable(false);
        addInstallationFrame.setVisible(true);
        addInstallationFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(addInstallation.backToMainMenu){
                        addInstallationFrame.dispose();
                        addInstallation=new AddInstallation(conn, screenWidth, screenHeight);
                        hide=false;
                        initializeAirConList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }//GEN-LAST:event_btnInsAddActionPerformed

    private void btnInsEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsEditActionPerformed
        modelAircon=(DefaultTableModel)tableInsItemsSet.getModel();
        List<String> descriptions=new ArrayList<String>();
        List<Float> quantities=new ArrayList<Float>();
        List<String> units=new ArrayList<String>();
        List<Float> prices=new ArrayList<Float>();
        String[] rowData=new String[modelAircon.getColumnCount()];
        for(int i=0;i<modelAircon.getRowCount();i++){
            for(int j=0;j<modelAircon.getColumnCount();j++)
                rowData[j]=modelAircon.getValueAt(i, j).toString();
            descriptions.add(rowData[0]);
            quantities.add(Float.parseFloat(rowData[1]));
            units.add(rowData[2]);
        } //get table values
        hide=true;
        editInstallationFrame=new JFrame("Edit an Installation");
        editInstallation=new EditInstallation(conn, screenWidth, screenHeight, Integer.parseInt(txtInsID.getText()),txtInsBrand.getText(),txtInsModel.getText(),Float.parseFloat(txtInsHorsePower.getText()),txtInsDescription.getText(),installation.getIDs(),installation.getQuantities(),installation.getUnits(),installation.getItemIDs(),installation.getItemNames());
        editInstallationFrame.add(editInstallation);
        editInstallationFrame.setSize(editInstallation.getWidth(), editInstallation.getHeight());
        editInstallationFrame.setLocation((screenWidth-editInstallation.getWidth())/2,(screenHeight-editInstallation.getHeight())/2);
        editInstallationFrame.setResizable(false);
        editInstallationFrame.setVisible(true);
        editInstallationFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(editInstallation.backToMainMenu){
                        editInstallationFrame.dispose();
                        editInstallation=new EditInstallation(conn, screenWidth, screenHeight, Integer.parseInt(txtInsID.getText()),txtInsBrand.getText(),txtInsModel.getText(),Float.parseFloat(txtInsHorsePower.getText()),txtInsDescription.getText(),installation.getIDs(),installation.getQuantities(),installation.getUnits(),installation.getItemIDs(),installation.getItemNames());
                        hide=false;
                        initializeAirConList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }//GEN-LAST:event_btnInsEditActionPerformed

    private void btnSuppAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuppAddActionPerformed
        hide=true;
        addSupplierFrame=new JFrame("Add a Supplier");
        addSupplier=new AddSupplier(conn, screenWidth, screenHeight);
        addSupplierFrame.add(addSupplier);
        addSupplierFrame.setSize(addSupplier.getWidth(), addSupplier.getHeight());
        addSupplierFrame.setLocation((screenWidth-addSupplier.getWidth())/2,(screenHeight-addSupplier.getHeight())/2);
        addSupplierFrame.setResizable(false);
        addSupplierFrame.setVisible(true);
        addSupplierFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ActionListener actionListener=new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent actionEvent){
                try{
                    if(addSupplier.backToMainMenu){
                        addSupplierFrame.dispose();
                        addSupplier=new AddSupplier(conn, screenWidth, screenHeight);
                        hide=false;
                        initializeSupplierList();
                    }
                }catch(Exception e){e.printStackTrace();}
            }
        };
        Timer timer=new Timer(0, actionListener);
        timer.start();
    }//GEN-LAST:event_btnSuppAddActionPerformed

    private void btnSuppEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuppEditActionPerformed
        if(btnSuppEdit.getText().equals("Edit")){
            btnSuppAdd.setEnabled(false);
            btnSuppEdit.setText("Save");
            txtSName.setEnabled(true);
            txtSAddress.setEnabled(true);
            txtSConNum.setEnabled(true);
            listSuppliers.setEnabled(false);
            btnSuppSearch.setEnabled(false);
        }
        else{
            supplierQuery=new SupplierQuery(conn);
            supplierQuery.interpretSearchBy(cbxSuppSearchBy.getSelectedIndex());
            if(txtSName.getText().equals("") || txtSAddress.getText().equals("") || txtSConNum.getText().equals(""))
                JOptionPane.showMessageDialog(null, "All fields cannot be empty!");
            else if(!checkNumber(txtSConNum.getText()))
                JOptionPane.showMessageDialog(null, "Invalid phone number!");
            else{
                supplierQuery.editSupplier(Integer.parseInt(txtSID.getText()),txtSName.getText(),txtSAddress.getText(),txtSConNum.getText());
                int j=listSuppliers.getSelectedIndex();
                DefaultListModel listModel = new DefaultListModel();
                suppliers=supplierQuery.initializeSuppliers();
                for(int i=0;i<suppliers.size();i++)
                    listModel.addElement(suppliers.get(i).getName());
                listSuppliers.setModel(listModel);
                listSuppliers.setSelectedIndex(j); //update supplier list
                btnSuppAdd.setEnabled(true);
                btnSuppEdit.setText("Edit");
                txtSName.setEnabled(false);
                txtSAddress.setEnabled(false);
                txtSConNum.setEnabled(false);
                listSuppliers.setEnabled(true);
                btnSuppSearch.setEnabled(true);
            }
        }
    }//GEN-LAST:event_btnSuppEditActionPerformed

    private void btnSUSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSUSearchActionPerformed
        if(txtSU.getText().equals("") && !cbxSUSearchBy.getSelectedItem().toString().equals("All"))
            JOptionPane.showMessageDialog(null, "Search box cannot be empty!");
        else{
            if(cbxSUSearchBy.getSelectedItem().toString().equals("All"))
                users=userQuery.initializeUsers();
            else
                users=userQuery.search(txtSU.getText());
            DefaultListModel listModel = new DefaultListModel();
            try{
                for(int i=0;i<users.size();i++)
                    listModel.addElement(users.get(i).getFirstName() + " " + users.get(i).getLastName());
                listUsers.setModel(listModel);
            }catch(Exception e){
                users=userQuery.initializeUsers();
                for(int i=0;i<users.size();i++)
                    listModel.addElement(users.get(i).getFirstName() + " " + users.get(i).getLastName());
                listUsers.setModel(listModel);
            }
        }
    }//GEN-LAST:event_btnSUSearchActionPerformed

    private void btnInvSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInvSearchActionPerformed
        if(txtInv.getText().equals("") && !cbxInvSearchBy.getSelectedItem().toString().equals("All"))
            JOptionPane.showMessageDialog(null, "Search box cannot be empty!");
        else{
            if(cbxInvSearchBy.getSelectedItem().toString().equals("All"))
                items=itemQuery.initializeItems();
            else
                items=itemQuery.search(txtInv.getText());
            DefaultListModel listModel = new DefaultListModel();
            try{
                for(int i=0;i<items.size();i++)
                    listModel.addElement(items.get(i).getDescription());
                listItems.setModel(listModel);
            }catch(Exception e){
                items=itemQuery.initializeItems();
                for(int i=0;i<items.size();i++)
                    listModel.addElement(items.get(i).getDescription());
                listItems.setModel(listModel);
            }
        }
    }//GEN-LAST:event_btnInvSearchActionPerformed

    private void btnCustSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustSearchActionPerformed
        if(txtCust.getText().equals("") && !cbxCustSearchBy.getSelectedItem().toString().equals("All"))
            JOptionPane.showMessageDialog(null, "Search box cannot be empty!");
        else{
            if(cbxCustSearchBy.getSelectedItem().toString().equals("All"))
                customers=customerQuery.initializeCustomers();
            else
                customers=customerQuery.search(txtCust.getText());
            DefaultListModel listModel = new DefaultListModel();
            try{
                for(int i=0;i<customers.size();i++)
                    listModel.addElement(customers.get(i).getName());
                listCustomers.setModel(listModel);
            }catch(Exception e){
                customers=customerQuery.initializeCustomers();
                for(int i=0;i<customers.size();i++)
                    listModel.addElement(customers.get(i).getName());
                listCustomers.setModel(listModel);
            }
        }
    }//GEN-LAST:event_btnCustSearchActionPerformed

    private void btnSuppSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuppSearchActionPerformed
        if(txtSupp.getText().equals("") && !cbxSuppSearchBy.getSelectedItem().toString().equals("All"))
            JOptionPane.showMessageDialog(null, "Search box cannot be empty!");
        else{
            if(cbxSuppSearchBy.getSelectedItem().toString().equals("All"))
                suppliers=supplierQuery.initializeSuppliers();
            else
                suppliers=supplierQuery.search(txtSupp.getText());
            DefaultListModel listModel = new DefaultListModel();
            try{
                for(int i=0;i<suppliers.size();i++)
                    listModel.addElement(suppliers.get(i).getName());
                listSuppliers.setModel(listModel);
            }catch(Exception e){
                suppliers=supplierQuery.initializeSuppliers();
                for(int i=0;i<suppliers.size();i++)
                    listModel.addElement(suppliers.get(i).getName());
                listSuppliers.setModel(listModel);
            }
        }
    }//GEN-LAST:event_btnSuppSearchActionPerformed

    private void TRToCSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TRToCSVActionPerformed
        String outputFile = "Transaction (Releases).csv";
	try{
            CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, false), ',');
            csvOutput.write("Order ID");
            csvOutput.write("Customer");
            csvOutput.write("Date");
            csvOutput.write("Status");
            csvOutput.write("Serial Number");
            csvOutput.write("Brand");
            csvOutput.write("Model");
            csvOutput.write("Quantity");
            csvOutput.write("Horsepower");
            csvOutput.write("Price");
            csvOutput.endRecord();
            for(int i=0;i<orders.size();i++){
                csvOutput.write(orders.get(i).getOrderID()+"");
                csvOutput.write(orders.get(i).getCustomerName());
                csvOutput.write(orders.get(i).getDate().toString());
                csvOutput.write(orders.get(i).getStatus());
                TransactionRelease order=releaseQuery.search(orders.get(i).getOrderID());
                for(int j=0;j<order.getSerialNumbers().size();j++){
                    if(j!=0)
                        for(int k=0;k<4;k++)
                            csvOutput.write("");
                    csvOutput.write(order.getSerialNumbers().get(j).toString());
                    csvOutput.write(order.getBrands().get(j));
                    csvOutput.write(order.getModels().get(j));
                    csvOutput.write(order.getQuantities().get(j).toString());
                    csvOutput.write(order.getHorsePowers().get(j).toString());
                    csvOutput.write(order.getPrices().get(j).toString());
                    csvOutput.endRecord();
                }
            }
            csvOutput.close();
            JOptionPane.showMessageDialog(null, "Releases CSV file successfully generated!");
	}
        catch (IOException e){
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "File is still open. Please close it first.");
	}
    }//GEN-LAST:event_TRToCSVActionPerformed

    private void btnTPToCSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTPToCSVActionPerformed
        String outputFile = "Transaction (Purchases).csv";
	try{
            CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, false), ',');
            csvOutput.write("Purchase ID");
            csvOutput.write("Supplier");
            csvOutput.write("Date");
            csvOutput.write("Status");
            csvOutput.write("Item");
            csvOutput.write("Quantity");
            csvOutput.write("Unit");
            csvOutput.write("Price");
            csvOutput.endRecord();
            for(int i=0;i<purchases.size();i++){
                csvOutput.write(purchases.get(i).getPurchaseID()+"");
                csvOutput.write(purchases.get(i).getSupplierName());
                csvOutput.write(purchases.get(i).getDate().toString());
                csvOutput.write(purchases.get(i).getStatus());
                TransactionPurchase purchase=purchaseQuery.search(purchases.get(i).getPurchaseID());
                for(int j=0;j<purchase.getIDs().size();j++){
                    if(j!=0)
                        for(int k=0;k<4;k++)
                            csvOutput.write("");
                    csvOutput.write(purchase.getItemNames().get(j));
                    csvOutput.write(purchase.getQuantities().get(j).toString());
                    csvOutput.write(purchase.getUnits().get(j));
                    csvOutput.write(purchase.getPrices().get(j).toString());
                    csvOutput.endRecord();
                }
            }
            csvOutput.close();
            JOptionPane.showMessageDialog(null, "Purchases CSV file successfully generated!");
	}
        catch (IOException e){
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "File is still open. Please close it first.");
	}
    }//GEN-LAST:event_btnTPToCSVActionPerformed

    private void btnInsToCSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsToCSVActionPerformed
        String outputFile = "Installations.csv";
	try{
            CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, false), ',');
            csvOutput.write("Brand");
            csvOutput.write("Model");
            csvOutput.write("Description");
            csvOutput.write("Horsepower");
            csvOutput.write("Item");
            csvOutput.write("Quantity");
            csvOutput.write("Unit");
            csvOutput.write("Price");
            csvOutput.endRecord();
            for(int i=0;i<installations.size();i++){
                csvOutput.write(installations.get(i).getBrand());
                csvOutput.write(installations.get(i).getModel());
                csvOutput.write(installations.get(i).getDescription());
                csvOutput.write(installations.get(i).getHorsePower()+"");
                Installation installation=installationQuery.search(installations.get(i).getBrand(),installations.get(i).getModel());
                for(int j=0;j<installation.getIDs().size();j++){
                    if(j!=0)
                        for(int k=0;k<4;k++)
                            csvOutput.write("");
                    csvOutput.write(installation.getItemNames().get(j));
                    csvOutput.write(installation.getQuantities().get(j).toString());
                    csvOutput.write(installation.getUnits().get(j));
                    csvOutput.write(installation.getPrices().get(j).toString());
                    csvOutput.endRecord();
                }
            }
            csvOutput.close();
            JOptionPane.showMessageDialog(null, "Installations CSV file successfully generated!");
	}
        catch (IOException e){
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "File is still open. Please close it first.");
	}
    }//GEN-LAST:event_btnInsToCSVActionPerformed

    private void btnInvToCSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInvToCSVActionPerformed
        String outputFile = "Items.csv";
	try{
            CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, false), ',');
            csvOutput.write("Description");
            csvOutput.write("Quantity");
            csvOutput.write("Unit");
            csvOutput.write("Price");
            csvOutput.endRecord();
            for(int i=0;i<items.size();i++){
                csvOutput.write(items.get(i).getDescription());
                csvOutput.write(items.get(i).getQuantity()+"");
                csvOutput.write(items.get(i).getQuantityUnit());
                csvOutput.write(items.get(i).getUnitPrice()+"");
                csvOutput.endRecord();
            }
            csvOutput.close();
            JOptionPane.showMessageDialog(null, "Items CSV file successfully generated!");
	}
        catch (IOException e){
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "File is still open. Please close it first.");
	}
    }//GEN-LAST:event_btnInvToCSVActionPerformed

    private void btnCustToCSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustToCSVActionPerformed
        String outputFile = "Customers.csv";
	try{
            CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, false), ',');
            csvOutput.write("Name");
            csvOutput.write("Address");
            csvOutput.write("Contact Number/s");
            csvOutput.write("Remarks");
            csvOutput.endRecord();
            for(int i=0;i<customers.size();i++){
                csvOutput.write(customers.get(i).getName());
                csvOutput.write(customers.get(i).getAddress()+"");
                csvOutput.write(customers.get(i).getContactNumbers());
                csvOutput.write(customers.get(i).getRemarks()+"");
                csvOutput.endRecord();
            }
            csvOutput.close();
            JOptionPane.showMessageDialog(null, "Customers CSV file successfully generated!");
	}
        catch (IOException e){
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "File is still open. Please close it first.");
	}
    }//GEN-LAST:event_btnCustToCSVActionPerformed

    private void btnSuppToCSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuppToCSVActionPerformed
        String outputFile = "Suppliers.csv";
	try{
            CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, false), ',');
            csvOutput.write("Name");
            csvOutput.write("Address");
            csvOutput.write("Contact Number/s");
            csvOutput.endRecord();
            for(int i=0;i<suppliers.size();i++){
                csvOutput.write(suppliers.get(i).getName());
                csvOutput.write(suppliers.get(i).getAddress()+"");
                csvOutput.write(suppliers.get(i).getContactNumbers());
                csvOutput.endRecord();
            }
            csvOutput.close();
            JOptionPane.showMessageDialog(null, "Suppliers CSV file successfully generated!");
	}
        catch (IOException e){
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "File is still open. Please close it first.");
	}
    }//GEN-LAST:event_btnSuppToCSVActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCustAdd;
    private javax.swing.JButton btnCustEdit;
    private javax.swing.JButton btnCustSearch;
    private javax.swing.JButton btnCustToCSV;
    private javax.swing.JButton btnInsAdd;
    private javax.swing.JButton btnInsEdit;
    private javax.swing.JButton btnInsToCSV;
    private javax.swing.JButton btnInvAdd;
    private javax.swing.JButton btnInvEdit;
    private javax.swing.JButton btnInvSearch;
    private javax.swing.JButton btnInvToCSV;
    private javax.swing.JButton btnLogout;
    private javax.swing.JButton btnSUAdd;
    private javax.swing.JButton btnSUEdit;
    private javax.swing.JButton btnSUSearch;
    private javax.swing.JButton btnSuppAdd;
    private javax.swing.JButton btnSuppEdit;
    private javax.swing.JButton btnSuppSearch;
    private javax.swing.JButton btnSuppToCSV;
    private javax.swing.JButton btnTPAdd;
    private javax.swing.JButton btnTPEdit;
    private javax.swing.JButton btnTPToCSV;
    private javax.swing.JButton btnTRAdd;
    private javax.swing.JButton btnTREdit;
    private javax.swing.JButton btnTRToCSV;
    private javax.swing.JComboBox cbxCustSearchBy;
    private javax.swing.JComboBox cbxInvSearchBy;
    private javax.swing.JComboBox cbxInvUnit;
    private javax.swing.JComboBox cbxSUPosition;
    private javax.swing.JComboBox cbxSUSearchBy;
    private javax.swing.JComboBox cbxSearchByBrand;
    private javax.swing.JComboBox cbxSearchByTPStatus;
    private javax.swing.JComboBox cbxSearchByTRStatus;
    private javax.swing.JComboBox cbxSuppSearchBy;
    private javax.swing.JComboBox cbxTPStatus;
    private javax.swing.JComboBox cbxTRStatus;
    private javax.swing.JLabel dateDayTime;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JLabel jLabel49;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel50;
    private javax.swing.JLabel jLabel51;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel69;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel70;
    private javax.swing.JLabel jLabel71;
    private javax.swing.JLabel jLabel72;
    private javax.swing.JLabel jLabel73;
    private javax.swing.JLabel jLabel74;
    private javax.swing.JLabel jLabel75;
    private javax.swing.JLabel jLabel77;
    private javax.swing.JLabel jLabel78;
    private javax.swing.JLabel jLabel79;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel80;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPasswordField jPasswordField1;
    private javax.swing.JPasswordField jPasswordField2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane14;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JLabel labelTPTotalPrice;
    private javax.swing.JLabel labelTRTotalPrice;
    private javax.swing.JLabel lblUser;
    private javax.swing.JList listAirConUnits;
    private javax.swing.JList listCustomers;
    private javax.swing.JList listItems;
    private javax.swing.JList listMaterials;
    private javax.swing.JList listPurchases;
    private javax.swing.JList listReleases;
    private javax.swing.JList listSuppliers;
    private javax.swing.JList listUsers;
    private javax.swing.JPanel panelCustomer;
    private javax.swing.JPanel panelInstallation;
    private javax.swing.JPanel panelInventory;
    private javax.swing.JPanel panelMonitorItemPrices;
    private javax.swing.JPanel panelPurchases;
    private javax.swing.JPanel panelReleases;
    private javax.swing.JPanel panelSU;
    private javax.swing.JPanel panelSupplier;
    private javax.swing.JPanel panelTransactions;
    private javax.swing.JTabbedPane tabMainMenu;
    private javax.swing.JTabbedPane tabTransactions;
    private javax.swing.JTable tableInsItemsSet;
    private javax.swing.JTable tableMonitorItemPrices;
    private javax.swing.JTable tableTPOrders;
    private javax.swing.JTable tableTROrders;
    private javax.swing.JTextField txtCAddress;
    private javax.swing.JTextField txtCConNum;
    private javax.swing.JTextField txtCID;
    private javax.swing.JTextField txtCName;
    private javax.swing.JTextField txtCRemarks;
    private javax.swing.JTextField txtCust;
    private javax.swing.JTextField txtInsBrand;
    private javax.swing.JTextField txtInsDescription;
    private javax.swing.JTextField txtInsHorsePower;
    private javax.swing.JTextField txtInsID;
    private javax.swing.JTextField txtInsModel;
    private javax.swing.JTextField txtInv;
    private javax.swing.JTextField txtInvDescription;
    private javax.swing.JTextField txtInvID;
    private javax.swing.JTextField txtInvPrice;
    private javax.swing.JTextField txtInvQuantity;
    private javax.swing.JTextField txtItemDescription;
    private javax.swing.JTextField txtSAddress;
    private javax.swing.JTextField txtSConNum;
    private javax.swing.JTextField txtSID;
    private javax.swing.JTextField txtSName;
    private javax.swing.JTextField txtSU;
    private javax.swing.JTextField txtSUFirstname;
    private javax.swing.JTextField txtSULastname;
    private javax.swing.JTextField txtSUUsername;
    private javax.swing.JTextField txtSupp;
    private javax.swing.JTextField txtTPDate;
    private javax.swing.JTextField txtTPID;
    private javax.swing.JTextField txtTPName;
    private javax.swing.JTextField txtTRDate;
    private javax.swing.JTextField txtTRID;
    private javax.swing.JTextField txtTRName;
    // End of variables declaration//GEN-END:variables
}
